Woo Recent Posts
Empty Widget Titles should be allowed (1 post)

  1. helgatheviking
    Posted 2 years ago #

    If I don't want a widget title I ought to be able to save an empty value and have the widget title not display. from the widget() method:

    $title = apply_filters( 'widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title'], $instance, $this->id_base);

    Your code is forcing the title to be "Recent Posts" even if I don't want a title. I think a better alternative would be to conditionally display the title if it exists:

    $title = apply_filters( 'widget_title', isset($instance['title']) ? $instance['title'] : '', $instance, $this->id_base);
            $widget_output_template = (empty($instance['widget_output_template'])) ? $this->default_config['widget_output_template'] : $instance['widget_output_template'];
            if( $title ) echo $before_title . $title . $after_title;

    and have "Recent Posts" as the suggested default in the form() method of the widget.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Woo Recent Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by helgatheviking
  • This topic is not resolved
  • WordPress version: 3.5.1