• I would like to use the standard Recent Posts widget and widget logic to show only recent posts that have been tagged with either “news” or “blog”. ‘

    I think that I need to check the box at the bottom of the widget page to allow me to filter ‘widget_content’. I then understand that I need to add a line similar to the following to functions.php

    add_filter(‘widget_content’, ‘tag_filter’, [priority], 2);

    … I then am supposed to create a function to show what I would like which is where I get stuck. It would be something like the following maybe?

    function tag_filter($content=’has_tag(‘news’)’, $widget_id=’2′)

    The desired effect would be a recent post widget that is showing the most recent post that are tagged with the “news”.

    Am I close?
    Thanks for the help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m afraid the widget_content filter isn’t as clever as you were hoping for – it just allows you to intercept and manipulate the HTML output by a widget. I don’t think it’s really feasible to do what you want with it.

    Try looking for a plugin that provides a widget that shows latest posts with specific tag(s). The query posts widget perhaps

    http://justintadlock.com/archives/2009/03/15/query-posts-widget-wordpress-plugin

    Thread Starter shagen

    (@shagen)

    Great suggestion! I will definitely check this out and try and report back with how things went. I had a feeling I was wanting more out of Widget logic than it could give.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Widget Login Plug-in using 'widget_content' filter and tags’ is closed to new replies.