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

admin in FT • 27,994 views • Share/Save

Comments All, 1–25, 26–50, 51–75, 76–100, 101–125, 126–150, 151–175, 176–212.

  1. E-TARD on 7 October 2009

    Thank You soo much for making this plugin
    I needed soemthing like this real bad.
    Keep up the good work dude.

    P.S. something you may want to add to this plugin
    would be an option where what users input into the box will not be what posts/pages you want the widget to show up on but what posts/pages you don’t want the widget to show up on this way I will not have to input soo much.
    just a thought :)

  2. admin on 8 October 2009

    you can do that already using the logical NOT exclamation mark. read the notes here on ‘building your own’ code http://wordpress.org/extend/plugins/widget-logic/other_notes/

  3. Levi on 13 October 2009

    I am trying to use this plugin to get ttftitles plugin to work in my sidebar. Which I did get to work, but when activated, I lose all of my page code past my sidebar. In my case the footer. If I turn off the WL plugin or delete the function for ttftitles, for the footer returns.

    Any Ideas?

    Thanks in advance.

  4. admin on 13 October 2009

    sounds like your widget_content filter function is throwing an error. what’s your code? have you adapted it from my code given on

    http://wordpress.org/extend/plugins/widget-logic/other_notes/ ?

    to check that, change the filter function to return $content untouched.

  5. kippiper on 22 October 2009

    Hi guys!

    THANKS so much for this widget! And I already have a question. The client wants a specific page to be his opening page for his site. The page in the menu is called “Home”. When I go to the Pages>Edit section of the Dashboard, there is no page name showing in the path for me to put in the is_page() code.

    The path to this page (on the mockup of this site) is just http://bestbiztips.com/quickmedquote – and I tried putting ‘index’ in the code with no success.

    How do you suggest I code Widget Logic for specific widgets to appear on this page?

    Thanks bunches!

  6. Home Based MLM on 23 October 2009

    I’ve been wondering for a long time now, but can widgets be placed only on a specific page? I’m thinking it’s impossible with the way blogs work.

  7. admin on 23 October 2009

    kippiper, what you want is the condition for the front page, take a look at

    http://codex.wordpress.org/Conditional_Tags#The_Main_Page

    at the differences between is_home and is_front_page. this is asked a lot and IS in the main faq http://wordpress.org/extend/plugins/widget-logic/faq/

    more generically if anyone else is looking for how to get widgets on specific wordpress PAGEs, take a look http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

    you can use the numerical ID, URL slug, or title of a page. the URL slug is simple enough to find, the ID you can get from clicking to edit the page and looking in the URL for post=xxx

  8. kippiper on 26 October 2009

    Hi Admin -

    Thanks so much for taking the time to graciously answer my silly question. I had looked in the FAQ and obviously was not “cluing in” on the terminology for the answer.

    However, I am still having issues. My Settings>Reading is set to have “Front Page Displays” as the static page “Home”. However, when I code in Widget Logic is_front_page(‘Home’), the widget still does not appear.

    Am I missing something?

    Thanks!

  9. kippiper on 26 October 2009

    I GOT IT! Thanks soooooooo much!

  10. ian on 4 November 2009

    Widget Logic is great!

    question:
    How do I check, within sidebar.php if widgets are active for that page? I have div tags wrapping the widgets to create a right column. However, I need to hide those divs if no widgets are appearing on a page. Hope this makes sense.

    Thanks for your help.

  11. admin on 4 November 2009

    hmm. i’m not sure what’s your best bet

    i was thinking of adding a “widget count so far” global, but that would only be useful AFTER the sidebar has been printed, which would (at bare minimum) include the open DIV or UL tag for your sidebar.

    could you use CSS to add “display:none” for that bit of the page under the right conditions? if so, the “widget count so far” would be useful to identify that condition of course, and i’ll add it in to the code.

    I think you’d have to add the STYLE section in the footer – i don’t think it would work within the sidebar would it? so that would be something you’d add to your own footer.php template i think

  12. frank on 8 November 2009

    I’m having some trouble getting the plugin to help me change the titles of my sidebar widgets using the ttftitles plugin. I activated the ‘widget_content’ filter then grabbed this code from the ‘other notes’ section of the plugin homepage and put it in my functions.php file:

    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;
    }

    Am I missing a step? Do I need to add any code to the 'Widget logic' section of the widgets dashboard?

  13. Alan on 8 November 2009

    I expect you haven’t used add_filter to connect your function to the filter. Look again at the ‘other notes’ section

  14. Claire Doyle Ragin on 12 November 2009

    I have split my blog into two categories, “blog” and “news”, and display each on a separate page. What would the array syntax be for pages website.com/category/blog/ and website.com/category/news/ ?

  15. virg on 17 November 2009

    Thanks for the plugin!

    I have one question.

    What code would I put for a widget to appear just on 1 page? the “is” code excludes the page I add.

  16. serenine on 25 November 2009

    Hello,

    Just discovered this plugin! Will be donating soon for sure :)

    I’ve looked here:
    http://wordpress.org/extend/plugins/widget-logic/other_notes/

    and here:
    http://wordpress.org/support/topic/207694

    How do I get a widget to show ONLY on a page that is a subpage of a parent page.

    This looks close but does not work:

    global $post; return (in_array(77,get_post_ancestors($post))); — WP page that is a child of page 77

    Thank you very much in advance for your help.

  17. Alan on 27 November 2009

    That code will work to find pages that are subpages of the page with ID 77. what are you after – pages that are subpages of any page?

  18. Deepak on 28 November 2009

    Thank you for plugin, will this work on latest wordpress..

  19. serenine on 29 November 2009

    I’ve got it figured out. I had super cache on and it was not showing correctly. The code that worked is pretty simple: is_page(‘141′)
    Thanks Alan. P.S. Just made a small contribution to the Cancer Research UK on your behalf. Thanks for a very useful plugin!

  20. Daryl Lozupone on 30 November 2009

    Mr Freaky Trigger,

    I am glad you enjoyed the Video Tutorial I put together. I sincerely appreciate you linking to it here on your site

  21. Alan on 1 December 2009

    Thanks serenine and to anyone donating to Widget Logic’s Cancer Research UK drive.

    And thanks too to you Daryl for taking the time to make the video.

  22. Us3rz on 2 December 2009

    Hi, I really love this plugin but I keep running into errors whenever I do conditional statements other than the simple statements. When I add the conditional: !(is_single(‘798′)
    I get this error:
    wp-content/plugins/widget-logic/widget_logic.php(154) : eval()’d code on line 1

    I can’t get it to work on any of the conditional statments other than the basic true value statements. Not even statements like is_single(array(17, 19, 1, 11)) will work for me. I tried switching to the default wordpress theme and it still will not work.

    Any suggestions?

    EDITED: I figured out the first error, lol. I am ashamed I did, but I still have problems with complex strings; they give error outputs. I’ll have to copy them later to show though. Sorry. GREAT PLUGIN

  23. mycomputerkeepsfreezing on 7 December 2009

    i tried installing it for almost two days and i’m happy now.it worked.thanks for the plugin- no questions.Perfect!

  24. Robin on 17 December 2009

    Thank you so much for the video and explanation. My question is that there is a particular page on which I do NOT want the widget to appear, but I want it to appear on all others. How do I do that?

  25. Angelia on 22 December 2009

    Hi. I’m really sorry to be commenting here as this has to do with your relocate/upload plugin, but, I can’t for the life of me find anywhere to contact you about this anywhere else. There was a user who had the exact same issue as I am having in the comments at the repository, the filter for viewing the files from the RU folder in media library not working, and it was solved with the changes that you guys made to v.014, but, this has not worked for me and I am having a devil of a time figuring out what is causing this not to work in my instance.
    General Settings in WP are: http://domainname.com/wpdirectory
    RU settings are:
    root: hostdirectory/homepages/hostdirectory/hostdirectory/htdocs/wpdirectory
    default: /homepages/hostdirectory/hostdirectory/htdocs/wpdirectory/wp-content/uploads
    I can upload to my RU created folders, and the files are then listed in the media library ( however the image does not show up ) but, I cannot get anything to show when I use the pull down menu to list only images in that folder. As well, if I try to move something back OUT of that folder and into the default location, I get a warning from the rename function that the file or directory does not exist ( line 51 of relocate-upload.php ) along with “cannot modify header info” errors from lines 72 and 73. I’m on WP 2.8.6. Do you have any idea why this might be occurring? The host I’m on is 1and1. Do you think it may have something to do with how they name the root folder? I’m really baffled and very much need this ability. I think this is a great plugin that you have written here, and would love to get it working properly. Any help would be greatly greatly appreciated ;-)
    By the way, I tried to register a few times for your site and each time got a “fake user” response. I’m real, I promise.

  26. admin on 22 December 2009

    your root and default location paths look unusual, and i think that that might be breaking the string chopping that goes into working out the changes in paths and URLs. which would explain missing previews, and possibly the failure to filter and move back

    can you just check for me that you have got those right.

    another thing. you say ‘I can upload to my RU created folders’. the method I use with RU is to upload to the default ‘wp-content/uploads/’ folders and use RU to move stuff from there to the special folders. are you saying that you are setting the WP uploader to upload to a specific folder (in the WP misc settings screen)

  27. Vince on 24 December 2009

    Great plugin!

    Is there such a thing as a WP conditional tag that allows for NOT statements i.w. “is_not_home()”? I’m trying to say that I want a widget to appear on all pages EXCEPT a specific page.

    Thanks!

  28. chodorowicz on 28 December 2009

    it’s such a usefull plugin – maaany thanks for making it!

  29. Martina on 30 December 2009

    Using the arras-theme I have one problem with your plugin with the widget “Last Previews”. I want this widget only appear on “home”. But the command “is_home()” doesn’t work. The widget cant be seen anywhere. What is wrong? Can you help me please?

    Your Widget Logic-Plugin seems to be the one I was looking for. :) It does its job very well, but only this problem irritates me a bit.

  30. ABRAHAM Morgan on 1 January 2010

    If found a bug inside the relocate-upload plugin.
    While using it on a windows based server, the ABSPATH constant contains the path in windows style but the \ is considered as an escaping character and diseappears.
    To correct this, i used url_encore function on the ABSPATH contant on line 102 in relocate_upload.php

  31. Sid Webb on 12 January 2010

    Something strange is happening. I am using two page templates. One is “main”. The other is “Gallery”. I am using the conditional “is_template” to determine which widgets show up on template. All my pages work fine except one…(see tab “Information/Let’s Talk”. All pages should look the same except “Gallery”. The only thing I can see that may cause the problem is that there are lots of posts on the “Let’s Talk” page. Any suggestions?

    http://www.sidwebb.com/WPress

  32. Sculley on 27 January 2010

    I feel really stupid….I don’t understand how to use the widget. I’m trying to get certain things to show on blog page but not on other pages. Currently, every page — even static pages with sidebar — have every widget and someone suggested I use this to only put things on blog sidebar. I looked in Admin > Widget but don’t see how to do it.

    Thanks!

  33. Alan on 27 January 2010

    Sid, have you tried the suggestions in the FAQ http://wordpress.org/extend/plugins/widget-logic/faq/
    Sculley, read the notes at http://wordpress.org/extend/plugins/widget-logic/

  34. Sculley on 27 January 2010

    I read that and it didn’t make sense. Sounds like you have to be a programmer type yes?

  35. Alan not logged in on 28 January 2010

    if you couldn’t make sense of the screenshots and other notes, then, yes you should consider using it quite a high-level programmer thing.

    there are other, friendlier plugins that allow you to show some. check out ‘widget context’ plugin

  36. Leah Raeder on 6 February 2010

    Just wanted to share this as an example for others who might be struggling with logical statements. Could be a good example to add to the notes. Sorry if it was already mentioned.

    I wanted to display widgets on all posts and pages EXCEPT for single posts in a certain category. I figured the following would work:

    !is_single() && !in_category(‘category’)

    However, this excluded the widgets not only from single posts in “category,” but from ALL single posts. It seemed like the AND operator was behaving as an OR operator. I tried enclosing the whole statement in parentheses, but it didn’t change anything. It took me a while to figure out that this unexpected result was because of the ! modifier.

    The proper syntax for this statement is:

    !(is_single() && in_category(‘category’))

    This will display widgets for everything except single posts in the category named “category.”

    Hope this is helpful to someone to make tearing my hair out worth it. :D

  37. Steve on 9 February 2010

    Really wish the instructions for TTF integration we’re clearer. Have read and re read the FAQ and Other Notes and like several posters here, am none the wiser. Shame

Back up to post. More comments: All, 1–25, 26–50, 51–75, 76–100, 101–125, 126–150, 151–175, 176–212.

Add your comment

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