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 • 31,911 views • Share/Save

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

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

  2. 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!

  3. chodorowicz on 28 December 2009

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

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

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

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

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

  8. 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/

  9. Sculley on 27 January 2010

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

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

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

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

  13. Scarlett on 10 February 2010

    I’m having the same issue as kippiper was. I can’t get this plugin to work when I’ve defined a static page as the front page of my site. I’ve tried setting these variations in the Widget Logic field of the widget with no results:

    is_front_page()
    is_front_page(‘4′)
    is_front_page(‘page-slug-here’)

    I’ve even tried is_page() with the ID and slug of the page, but the widget never shows up. I have “wp_reset_query” checked, and it’s not a theme issue, as I’m getting no results with the default Wordpress theme either. Any ideas?

  14. Scarlett on 10 February 2010

    One other thing – in trying other conditions, I’ve realized that the Widget Logic conditions aren’t working at all on my site. Either the widget displays on all pages or none, no matter which condition I try. I’ve attempted using the conditions on three different widgets with the same results. I’m using the Thesis theme, which has never clashed with any other plugin I’ve tried. Very odd.

    Additionally, wp_reset_query unchecks itself every time I leave the Widgets page in the WP admin.

  15. admin on 10 February 2010

    if you tick “use wp_reset_query fix” and hit the ’save’ button next to it, it should stick no bother. what version of wp are you on?

  16. Scarlett on 10 February 2010

    Unfortunately it doesn’t stick – wp_reset_query is always unchecked as soon as I leave the Widgets page. I’m using the most recent Wordpress upgrade (2.9.1, I believe?)

    I ended up switching to Slayer’s plugin – of the 3 I tried, it’s the only one that works. It might be a combination of my theme and the widgets I’m trying to implement this on, not sure!

  17. admin on 10 February 2010

    this site is 2.9.1 and i don’t get that behaviour. i would love to know if switching to a wp default theme cured that issue. (also if it made the logic work.)

  18. Scarlett on 11 February 2010

    I tried switching to three other themes with the same results. Really have no idea what the problem was and why the Slayer plugin solved it. I’m sorry I can’t be of more help!

  19. Robert on 17 February 2010

    I am not a php coder so most of this logic code makes no sense to me at all.
    I just want a line of code in Widget Logic to NOT display a widget on the Home page.

    Will this do it?

    is_not_home()

  20. Robert on 17 February 2010

    As an update—and when I use what I think is the logical line:

    is_home()

    The target widget disappears from the Home page and all other pages too, which is not what I want!

    I’m using WP2.9.1 and the Flexx Canvas 2.0 theme from ithemes.

  21. Robert on 17 February 2010

    And more—when I set

    is_front_page()

    It does the exact reverse of what I want. The Home page displays the widget and the other pages do not!

    Is this to do with using a static page?

    Driving me nuts.

  22. Robert on 17 February 2010

    To eat my own dogfood, the correct line turned out to be:

    !is_front_page()

  23. Rosemary on 25 February 2010

    Hi, I appreciate your widget-logic plugin’s approach, but am hesitant to install since it says you have not updated the plugin in many months (Last Updated: 2009-6-14). Do you anticipate keeping this plugin current?? Thanks.

  24. Alan on 25 February 2010

    Looking at the Compatibility widget on http://wordpress.org/extend/plugins/widget-logic/ says its working fine on 2.9.2 – i will update the ‘compatible up to’ text

  25. media on 1 March 2010

    I’m very very thank, because this plugin is sooo great and very usefull. Very great. I sue for many site. thanksss :)

  26. 逅客北极 on 1 March 2010

    Why do I use does not work!

  27. Cichlid on 3 March 2010

    Works for me. Using it on version 2.9.0 Thank you.

  28. Alan on 3 March 2010

    thanks.

    i’ve just updated the code to clear up the resetting wp_reset_query option that has been haunting me/the code for a very long time

  29. Cindrol on 4 March 2010

    thanks for the great post

  30. dandy on 6 March 2010

    A suggestion is to add a drop down of pages/subpages to choose from rather than a writable text field.

    Thanks

  31. admin on 6 March 2010

    Cheers. I have of course thought of something along those lines – of making it flip between free text code and a GUI set of tick-boxes/menus. there are other plugins out there that already offer something like that – I personally don’t like the way they’re done and I don’t want to duplicate their functionality either (people can use them instead).

    Also whenever I think about what to offer in the GUI, I get stuck thinking “what IS the most common things ppl will want”, between offering lots of confusing options, or only offering a few basics that will suit a small %age of ppl. at one point i was even pondering a user-defined library, but that was getting even more complex ui-wise, so in the end i’ve stuck with the ‘hardcore simplicity’ i started with

  32. vbulletin 4 styles on 10 March 2010

    Awesome plugin, this is really appreciated, ive been searching for something like this for weeks without any luck, Thanks

  33. Dave Thackeray on 11 March 2010

    First off: amazing plugin! Thanks for all your work.

    I’m using Widget Logic to display ads (OIO Publisher) in my sidebar on the home page and when a certain category is chosen.

    Using

    is_single() && in_category(‘fractional’)

    to display the ad only on posts in the fractional category.

    Which it does. But the problem is about 20px of the sidebar where the ad would sit, if it displayed, is displaying on every other, non-fractional post.

    Any ideas why this might be happening?

    Thanks a million!

  34. admin on 11 March 2010

    hard to say for sure, but it *sounds* like a CSS issue. give us a link. (i couldn’t see it on your linked site)

  35. Dave Thackeray on 11 March 2010

    You’re right: it’s a bleedin CSS issue. I’ve moved it to the left sidebar and all is well.

    Thanks!

    Dave

  36. jnforyou on 12 March 2010

    I am not the most well versed person when it comes to php, but I was hoping for some assistance.
    I am using the widget logic plugin with ttftitles, but have had problems rendering.

    I get this error: Warning: Missing argument 1 for the_ttftext(), called in /home/skyandcurb/blog.skyandcurb.com/wp-content/plugins/widget-logic/widget_logic.php(161) : eval()’d code on line 1 and defined in /home/skyandcurb/blog.skyandcurb.com/wp-content/plugins/ttftitles/ttftitles.php on line 980

    That is when I use “the_ttftext” in the widger logic form, however when I use “the_ttftext(Feed, $echo=true, $style=”navigation”)”

    I see the style, but no widget box. The “Use ‘widget_content’ filter” is checked and I have the filter code in my functions.php file.

    Are there any suggestions due to my lack of knowledge? Thanks

  37. erick on 12 March 2010

    works perfectly for me, thnx guys….

  38. admin on 12 March 2010

    @ jnforyou

    you don’t need anything in the per-widget ‘widget logic’ field to make the ttftitles thing work. all you need is the filter option ticked and the code you’ve put in the functions.php

  39. jnforyou on 12 March 2010

    Alan, Thank you for the quick response! The only problem I see now is only the first widget is using the ttftitle. Again, this may be my lack of php knowledge. But after seeing this, I’m wondering if there is something in functions.php overriding this?

  40. Alan on 12 March 2010

    the function i supply is tied to a specific format of widget that your sidebar might not be conforming to. the matching expression used “/<h2[^>]*>([^<]+)/” basically takes the first text after a and before the next HTML tag to give to ttftitles. it may be you need to adapt that.

    For troubleshooting, you can check that the filter is working and applying to every widget by changing

    return $content;

    at the end of the function to

    return $content.”WIDGET_CONTENT FILTER WORKING”;

    or something like that, which will add that extra text to the end of each widget.

  41. jnforyou on 12 March 2010

    Thanks again! I believe I have it figured out. in my functions the sidebar arrays were calling on:
    ‘before_title’ => ”,
    ‘after_title’ => ”

    I deleted the heading class, because I figured it was overriding the ttftitle and it worked great. Only one widget it giving me trouble, but I am going to check its styling.

  42. admin on 12 March 2010

    glad it’s working out for you.

    sorry that the WP comment system mangled my expression code originally (and your before/after_title code too?)

  43. Monroe Bertotti on 17 March 2010

    There are some very usefull information here , thanks

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

Add your comment

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