diff --git a/inc/post-tags.php b/inc/post-tags.php index 7882ca07e..d0024d1bd 100644 --- a/inc/post-tags.php +++ b/inc/post-tags.php @@ -42,7 +42,7 @@ function largo_modified_time( $echo=true, $post=null ) { /** * Given a time, if it was less than 24 hours ago return how many hours ago that was, otherwise return the 'F j, Y' formatted date - * @param int $modified the Unix timestamp for the modified date + * @param int $time the Unix timestamp for the modified date * @return string HTML for the either "x hours ago" or the submitted date, formatted * @since 0.5.5 * @see https://secure.php.net/manual/en/function.date.php @@ -51,15 +51,12 @@ function largo_modified_time( $echo=true, $post=null ) { function largo_time_diff( $time ) { $time_difference = current_time( 'timestamp' ) - $time; - if ( $time_difference < 86400 ) { - $output = sprintf( __( '%s ago', 'largo' ), - human_time_diff( $time, current_time( 'timestamp' ) ) - ); - } else { - $output = date( 'F j, Y', $time ); - } + $time = $time_difference < 86400 + ? human_time_diff( $time, current_time( 'timestamp' ) ) + : date( 'F j, Y', $time ); + + return sprintf( __( '%s ago', 'largo' ), $time ); - return $output; } /** diff --git a/inc/widgets/largo-about.php b/inc/widgets/largo-about.php index fa892606f..71b786ee8 100644 --- a/inc/widgets/largo-about.php +++ b/inc/widgets/largo-about.php @@ -2,49 +2,105 @@ /* * About this site */ + +/** + * Class largo_about_widget + */ class largo_about_widget extends WP_Widget { + /** + * largo_about_widget constructor. + */ function __construct() { $widget_ops = array( - 'classname' => 'largo-about', - 'description' => __('Show the site description from your theme options page', 'largo') + 'classname' => 'largo-about', + 'description' => __( 'Show the site description from your theme options page', 'largo' ) ); - parent::__construct( 'largo-about-widget', __('Largo About Site', 'largo'), $widget_ops); + parent::__construct( 'largo-about-widget', __( 'Largo About Site', 'largo' ), $widget_ops ); } + /** + * Echos output for the widget + * + * @param array $args + * @param array $instance + */ function widget( $args, $instance ) { - extract( $args ); - $title = apply_filters('widget_title', empty( $instance['title'] ) ? sprintf( __( 'About %s', 'largo' ), get_bloginfo('name') ) : $instance['title'], $instance, $this->id_base); + $args = wp_parse_args( $args, array( + 'before_widget' => '', + 'before_title' => '', + 'after_title' => '', + 'after_widget' => '', + )); - echo $before_widget; - if ( $title ) - echo $before_title . $title . $after_title; ?> + /* + * Set default title + */ + $instance = $this->_instance_defaults( $instance ); - -
- -Add a site description by visiting the Largo Theme Options page.', 'largo'); ?>
- + echo $args[ 'before_widget' ]; - id_base ); + + if ( $title ) { + echo "{$args[ 'before_title' ]}{$title}{$args[ 'after_title' ]}"; + } + + if ( of_get_option( 'site_blurb' ) ) { + echo '' . of_get_option( 'site_blurb' ) . '
'; + } else { + $link_title = __( 'The Largo Theme Options page', 'largo' ); + $options_url = site_url( '/wp-admin/themes.php?page=options-framework' ); + $message = sprintf( + __( '%sYou have not set a description for your site.%s Add a site description by visiting %sthe Largo Theme Options page%s.', 'largo' ), + '','', + "", '' + ); + echo "{$message}
"; + } + + echo $args[ 'after_widget' ]; } - function update( $new_instance, $old_instance ) { - $instance = $old_instance; - $instance['title'] = sanitize_text_field( $new_instance['title'] ); + /** + * @param array $new_instance The new widget instance + * @param array $instance The old Widget instance + * + * @return array + */ + function update( $new_instance, $instance ) { + $new_instance = $this->_instance_defaults( $new_instance ); + $instance[ 'title' ] = sanitize_text_field( $new_instance[ 'title' ] ); return $instance; } + /** + * Display form to allow updating title + * @param array $instance + * @return string Default return is 'noform'. + */ function form( $instance ) { - $defaults = array( 'title' => sprintf( __( 'About %s', 'largo' ), get_bloginfo('name') ) ); - $instance = wp_parse_args( (array) $instance, $defaults ); + $instance = wp_parse_args( (array) $instance, $this->_instance_defaults( $instance ) ); + $title_field_id = $this->get_field_id( 'title' ); + $title_field_name = $this->get_field_name( 'title' ); ?> -- - -
- + + + + sprintf( __( 'About %s', 'largo' ), get_bloginfo( 'name' ) ), + )); } } \ No newline at end of file diff --git a/partials/footer-widget-3col-default.php b/partials/footer-widget-3col-default.php index 1d06e2547..304d5e3df 100644 --- a/partials/footer-widget-3col-default.php +++ b/partials/footer-widget-3col-default.php @@ -5,17 +5,23 @@ diff --git a/partials/footer-widget-3col-equal.php b/partials/footer-widget-3col-equal.php index 151816a4d..8a1c40266 100644 --- a/partials/footer-widget-3col-equal.php +++ b/partials/footer-widget-3col-equal.php @@ -6,15 +6,18 @@ diff --git a/partials/footer-widget-4col.php b/partials/footer-widget-4col.php index da6766e03..64d83e3da 100644 --- a/partials/footer-widget-4col.php +++ b/partials/footer-widget-4col.php @@ -5,17 +5,21 @@ diff --git a/partials/sidebar-fallback.php b/partials/sidebar-fallback.php index bc0987826..606326fe9 100644 --- a/partials/sidebar-fallback.php +++ b/partials/sidebar-fallback.php @@ -24,11 +24,14 @@ ); } -the_widget( 'largo_featured_widget', array( - 'term' => 'sidebar-featured', - 'title' => __('We Recommend', 'largo'), - 'widget_class' => 'default', - 'num_posts' => 5, - 'num_sentences' => 2 - ) -); +/** + * @see https://github.com/INN/largo/issues/1467 + */ +//the_widget( 'largo_featured_widget', array( +// 'term' => 'sidebar-featured', +// 'title' => __('We Recommend', 'largo'), +// 'widget_class' => 'default', +// 'num_posts' => 5, +// 'num_sentences' => 2 +// ) +//);