WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Popular Posts
Suggestion : add 'widget_title' filter (2 posts)

  1. MLmsw
    Member
    Posted 3 years ago #

    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/

  2. whoaminobody
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic