WordPress.org

Support

Support » Plugins and Hacks » Woo Recent Posts » Empty Widget Titles should be allowed

Empty Widget Titles should be allowed

  • 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.

    http://wordpress.org/extend/plugins/woo-recent-posts/

  • The topic ‘Empty Widget Titles should be allowed’ is closed to new replies.
Skip to toolbar