Freaky Trigger’s WordPress Setup

Widget Logic

FT had a complex sidebar, but I decided to ‘widgetise’ it when Steve updated the theme in early 2008. To keep some of the special widgets appearing only when needed, I wrote a plugin to extend the functionality of widgets. Widget Logic allows widgets to appear or not depending on standard WP conditional tags, such as is_home() and is_single() and so on.

If you want to contact me about it you should address yourself to the WordPress org directory and perhaps post on the forum there. Or you can leave a comment here, below. PLEASE READ THE FAQ AND OTHER NOTES in the WordPress plugin directory first though.

If you find Widget Logic useful to you, then you could consider a small donation to Cancer Research UK – click ‘Donate’ on the widget over to the right there –>

VIDEO TUTORIAL! Popup or view on YouTube a screencast by Daryl Lozupone. Thanks to him.

Podcast Channels

Podcast Channels is a plugin that augments WP’s RSS feed with some extra elements, mostly in the ‘itunes’ namespace. It works with existing features of WP (auto-enclosures and the media library) to make a simple way to podcast, and allows different metadata in different RSS feeds – you can have as many channels as there are categories, tags, even blog authors.

Like a lot of people I found PodPress increasingly frustrating to use around WP2.6. I still see lots of people using it, but I found it was interfering with too many aspects of WP – wysiwyg editing, the media library, and so on. But there were only two things it did that I liked – show download stats, and allow multiple podcasts on a blog with their own rss and iTunes metadata. So i wrote a couple of plugins to target just those functions.

(I may release the stats plugin some day, but it’s nothing special, a bit clunky, and I really don’t want to support it.)

Freaky Trigger Theme

This was designed by Steve Mannion @ base58.com

Plugins FT uses

wow, look at all of them. FT salutes you


in • 124,661 views

Comments All, 1–25, 26–50, 51–75, 76–100, 101–125, 126–150, 151–175, 176–200, 201–225, 226–250, 251–275, 276–300, 301–325, 326–350, 351–375, 376–400, 401–425, 426–469.

  1. STS on 9 July 2008 #

    Hi,
    great plug-in! Can you help me?
    I try to hide the Categories Widget just from one page (id172)and show it on all other pages of the website.
    What is the code?
    Thanks !

  2. hershal on 21 July 2008 #

    I was wondering how to get a widget to appear on multiple pages by indicating which specific page id’s i want the widget to appear on. how is this done?

  3. Philix on 24 July 2008 #

    This is a great plug in :)

  4. Alan on 24 July 2008 #

    @ hershal

    you could use PHP’s logical OR operators like this

    is_page(‘about-me’) || is_page(’42′) || is_page(‘About Me And Joe’)

    or if you read http://codex.wordpress.org/Conditional_Tags you’ll see you can do the slightly more PHP-savvy but simpler

    is_page(array(42,’about-me’,'About Me And Joe’))

  5. Mieke Janssens on 31 October 2008 #

    This is one of the most useful plugins installed on my blogs. :-D

    I have just one question:
    How can I exclude just one page and show the widget on all other pages (home, single, page)?

    I have looked at the examples on the suggested WP site, but still don’t have a clue what code to add to the widget logic box.

    Can you please help me out?

    Greetz!
    Mieke

  6. admin on 31 October 2008 #

    add a ! on the front, which means NOT in PHP

    !is_home()

    etc. i will add this to the plugins FAQ on the wordpress plugins site

  7. Robert Griffin on 6 November 2008 #

    Alan,

    Love the widget Logic plug-in. Quick question though. I have been having problems with the speed of my site. I want to blame the host, they want to blame my plug-ins (I did go crazy with plug-ins when I started building my site). Since my site is so dynamic, at least the sidebar, I really can’t use a cache, or at least I don’t know how to use it with my sidebar and your plug-in.

    So 2 questions:
    1. Do conditional tags slow down the page loading by making additional calls to the database, or are conditional tags just reading the data que from the last query?

    2. Do you no of a way to be able to use your plug-in and WP Cache. WP Super Cache I don’t believe will help me since most of my users log in when they visit.

    thanks.

  8. Alan on 6 November 2008 #

    1 – i don’t believe so, no. if you look in wp-includes/query.php you’ll see a lot of the conditional tags code there. and they all do fairly simple manipulations of already established query results. is_home for instance is just

    global $wp_query; return $wp_query->is_home;

    and so on

    2 – the plugin doesn’t have any problem working with wp cache. unless you are using conditional tags that will produce different results over time.

  9. Thomas Clausen on 23 November 2008 #

    This looks like a fantastic plugin, can’t wait to try it out. It looks a bit like Ozh who sees ads, but your plugin seems more easy to use.

    Thanks a bunch.

  10. Tyrone on 6 December 2008 #

    Hi there, is there a way to make a text/html widget on my blog appear only to me (as an admin) or to (logged in users) using this plugin?

  11. Alan on 6 December 2008 #

    You can use the current_user_can(‘capability’) function, like this guy did:

    http://wordpress.org/support/topic/179656?replies=5

  12. matt on 16 December 2008 #

    Is this working on 2.7? I keep getting an error when I update anything site wide.
    Warning: Cannot modify header information – headers already sent by (output started at /home/gvegason/public_html/krah/wp-content/themes/fresh-editorial/functions.php:15) in /home/gvegason/public_html/krah/wp-includes/pluggable.php on line 850

  13. admin on 16 December 2008 #

    it’s working on my 2.7 install yes. what happens when you switch to the standard theme? as it looks like something in the functions.php of your “fresh-editorial” theme is where the problem starts

  14. Lesson Plans for Life on 23 December 2008 #

    This is exactly what I was looking for, but am having some slight issues. If I do is_category(‘fun’) the widget shows up when visiting page http://mydomain/category/fun/ but doesn’t show up on post in the category with urls http://mydomain/fun/post1

    Please help.

    Thanks,
    Eric

  15. admin on 23 December 2008 #

    you want to use is_category for category pages and in_category for posts that are in specified categories

    the pages at WP, specifically http://codex.wordpress.org/Conditional_Tags are very useful on points like this

  16. Lesson Plans for Life on 23 December 2008 #

    Thanks for your reply! I should have done a little more research before asking.

  17. Andy on 27 December 2008 #

    Hi-Thanks for all the useful information and the plugin–Andy

  18. Chanty on 27 December 2008 #

    Hi Alan,

    I’m trying to get this to work with TTFTitles, but I keep getting errors. Since I’m still pretty much a n00b at php, could you help me out? I copied and pasted the codes (add_filter and the function) in my theme’s functions.php file, but I keep getting ‘unexpected’ errors. Here’s my code:

    add_filter('the_ttftext', 'ttftext_widget_title', [priority], 2);

    function ttftext_widget_title($content='', $widget_id='')
    { preg_match("/]*>([^<]+)/",$content, $matches))
    $heading=$matches[1];
    $insert_img=the_ttftext( $heading, false );
    $content=preg_replace("/(]*>)[^<]+/","$1$insert_img",$content,1);
    return $content;
    }

    Thanks in advance :)

  19. Chanty on 27 December 2008 #

    Oh never mind, I fixed it myself :) There seemed to be an error in the filter for ttftitles, here’s the fixed version:

    function ttftext_widget_title($content='', $widget_id='')
    { preg_match("/]*>([^<]+)/",$content, $matches);
    $heading=$matches[1];
    $insert_img=the_ttftext( $heading, false );
    $content=preg_replace("/(]*>)[^<]+/","$1$insert_img",$content,1);
    return $content;
    }

    $matches was closed with )) instead of );

    One more thing though: what is meant with [priority]? I removed it to get rid of the “unexpected ‘]’” error.

  20. Alan on 27 December 2008 #

    oops! i hadn’t noticed that extra ) in the TTFcode before – it should be a semi-colon instead. (which is otherwise missing!)

    [priority] is the optional parameter that you can give when you register with add_filter – it allows you to set order of filtering routines if needed.

    http://codex.wordpress.org/Function_Reference/add_filter

    thanks for pointing both these out – i will try to remember to update the official WP repository

  21. Chanty on 28 December 2008 #

    Okay thanks! :)

  22. Illya on 30 December 2008 #

    This is such a great plugin. I thought I would have to code a whole new sidebar for every page other than my index page and this theme has solved my problems effortlessly. Your work on this plugin is greatly appreciated at ilapko.com. Thanks!

  23. admin on 30 December 2008 #

    :-)

    remember you can still define different sidebars to be invoked by different template files (home.php, single.php. etc)

  24. Martha on 31 December 2008 #

    I’m trying to figure out the right widget logic to use to display a widget only on a page or a sub-page of that page. I took a look at WP’s conditional tag information, and figured it is some variation upon

    ( is_page(‘title’) || $post->post_parent == ‘xx’ )

    But nothing I try seems to work. Any tips?

Back up to post. More comments: All, 1–25, 26–50, 51–75, 76–100, 101–125, 126–150, 151–175, 176–200, 201–225, 226–250, 251–275, 276–300, 301–325, 326–350, 351–375, 376–400, 401–425, 426–469.

Add your comment

(Register first to guarantee your comments don't get marked as spam)