WordPress.org

Support

Support » Plugins and Hacks » WordPress Popular Posts » [Plugin: WordPress Popular Posts] Suggestion : add 'widget_title' filter

[Plugin: WordPress Popular Posts] Suggestion : add 'widget_title' filter

  • Hi,

    I suggest for next release to add the ‘widget_title’ filter in the widget code.

    Here is a patch :

    — a/server/wp-content/plugins/wordpress-popular-posts/wordpress-popular-posts.php
    +++ b/server/wp-content/plugins/wordpress-popular-posts/wordpress-popular-posts.php
    @@ -123,6 +123,7 @@ if ( !class_exists(‘WordPressPopularPosts’) ) {
    // builds WordPress Popular Posts’ widgets
    function widget($args, $instance) {
    extract($args);
    + $title = apply_filters(‘widget_title’, $instance[‘title’]);
    echo “<!– WordPress Popular Posts Plugin v”. $this->version .” [W] [“.$instance[‘range’].”]”. (($instance[‘markup’][‘custom_html’]) ? ‘ [custom]’ : ‘ [regular]’) .” –>”.”\n”;
    echo $before_widget . “\n”;

    @@ -131,7 +132,7 @@ if ( !class_exists(‘WordPressPopularPosts’) ) {
    if ($instance[‘markup’][‘custom_html’] && $instance[‘markup’][‘title-start’] != “” && $instance[‘markup’][‘title-end’] != “” ) {
    echo htmlspecialchars_decode($instance[‘markup’][‘title-start’], ENT_QUOTES) . $instance[‘title’], ENT_QUOTES . htmlspecialchars_decode($instance[‘markup’][‘title-end’], ENT_QUOTES);
    } else {
    – echo $before_title . $instance[‘title’] . $after_title;
    + echo $before_title . $title . $after_title;
    }
    }


    1.7.4.msysgit.0

    http://wordpress.org/extend/plugins/wordpress-popular-posts/

Viewing 1 replies (of 1 total)
  • I too request this feature.

    What I’m trying to do is make the first word of each widget title a different color. With the filter in place, I can easily and transparently add some span tags to the title.

    The ‘widget_title’ filter is used in all the builtin wordpress widgets (wp-includes/default-widgets.php).

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WordPress Popular Posts] Suggestion : add 'widget_title' filter’ is closed to new replies.
Skip to toolbar