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,693 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. admin on 1 January 2009 #

    see my post here

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

  2. Martha on 2 January 2009 #

    Thank you, Alan! Awesome plugin and awesome help!

  3. Chanty on 10 January 2009 #

    Little annoyance: whenever I make changes to my widgets and save it, the Widget-Logic switch turns off and I need to click the Save button again for it to work… Is there a fix for this so that it stays on?

    Thanks :)

  4. admin on 10 January 2009 #

    “the Widget-Logic switch turns off” – do you meant the ‘widget_content’ filter option? if so are you sure you have an up-to-date version – that happened on an early version, but i’m pretty sure i fixed it.

    also – do you use the filter anyway? you don’t need that option ticked for ordinary widget logic options to work. it’s used to manipulate the content of widgets with special PHP code.

  5. Chanty on 10 January 2009 #

    I do use the filter for ttftitles; without the filter on it just displays normal text. And I’m using the latest version… (0.43)

  6. admin on 11 January 2009 #

    :-) ok just checking. surprised that the tick box is blanking as i thought that had been dealt with in a much earlier bug fix. will check on that for you.

    it’s about time i had an offical update – the ’2.7′ compatibility update i did needs flagging up properly.

    update:
    i can’t get the tick box to blank if i change a widget in WP 2.5/2.6 or 2.7. it might be that i’m on a development version that already tackled this issue. see if using that (download at http://wordpress.org/extend/plugins/widget-logic/download/) improves things for you.

    otherwise we’ll need to troubleshoot – go to the WP forums and post here http://wordpress.org/tags/widget-logic so we’ll go through it. things like deactivating plugins to see if there is another plugin out there that’s clashing with WL

    FURTHER UPDATE
    there is a fix for this in the development version. i will be updating it into a full release soon – mostly to update the documentation.

  7. Chanty on 14 January 2009 #

    Just updated, works fine now!

  8. Linda Webster on 15 January 2009 #

    I freaking love you for writing this plugin! You have made my day!! Thank you!

  9. Matteo on 21 January 2009 #

    Firstly, thanks so much for this plugin – it’s the answer to my prayers :)

    Thing is, I’ve found myself in a bit of a mess and I’m not sure how to fix it.

    What i wanted to do was to include a widget on all pages except two. I managed to exclude one page – using !is_page(’page-name’)- no problems, but wasn’t sure about how to exclude two pages at the same time.

    I decided to try a few things, starting with !is_page(’page-name’)||is_page(‘other-page-name) but immediately got an error message. I tried to undo it but everytime I tried to save a change or even delete a widget completely I got this message.

    Warning: array_keys() [function.array-keys]: The first argument should be an array in …./wp-content/plugins/widget-logic/widget_logic.php on line 29

    Warning: Invalid argument supplied for foreach()… /www/wp-content/plugins/widget-logic/widget_logic.php on line 29

    Warning: Cannot modify header information – headers already sent by (output started at …./wp-content/plugins/widget-logic/widget_logic.php:29) in …..www/wp-includes/pluggable.php on line 850

    I’ve tried deactivating and resinstalling the plugin but the problem persists even after a fresh install – ie can’t save any changes to any wiget without the error message. Also when i open a widget for editing the widget logic box always contains a single character (like ?, C. or I) in it which but i try to delete always comes back.

    The only thing that fixes the problems is deactivating the plugin altogether, which I really don’t want to have to do cause it will be such a life saver if I can get it working!

    Any ideas on what may be going wrong or how to fix this would be massively appreciated :)

    Thanks!

    Matteo

  10. Alan on 21 January 2009 #

    odd one. sounds like the WL options have got corrupt. try going to wp-admin/options.php in your setup and seeing if you can clear the ‘widget_logic’ field. if it says ‘serialized data’ you can’t clear it this way. you could clear it with a direct change in your database

    or you could hack (improve!) the widget logic code like this… Change line 18 from:

    if(!$wl_options = get_option(‘widget_logic’)) $wl_options = array();

    to

    if(!$wl_options = get_option(‘widget_logic’) || ! is_array($wl_options)) $wl_options = array();

    which should reset your preferences to all empty again.

    the code you need to exclude two pages will be

    !is_page(array(‘page-name’,'other-page-name’))

    HTH, Alan

  11. Matteo on 21 January 2009 #

    Hi Alan, thanks very much for helping out.

    I couldn’t locate a ‘widget_logic’ field in options.php so I tried making the other change you suggested. I replaced the code at line 18 but no joy. I then noticed that the same line of code appears again further on in the file so i tried replacing that as well. Don’t know if that was a good idea or not but it had the effect of eliminating those characters that kept appearing in the widget logic box.

    So I got somewher, but there’s still no luck with trying to save changes or implement new code. I keep getting the same error. It’s frustrating cause it was all working fine initially, so I just need to be able to start again from the beginning somehow. One other thing, after trying to save any widget changes the site front end also throws up the following error messages anywhere where a widget should be located.

    Warning: Unexpected character in input: ‘ in …..www/wp-content/plugins/widget-logic/widget_logic.php(132) : eval()’d code on line 1

    Parse error: syntax error, unexpected ‘)’ in …/www/wp-content/plugins/widget-logic/widget_logic.php(132) : eval()’d code on line 1

    Don’t know if that helps shed any light.

    Thanks again for your help.

    Matteo

  12. Alan on 22 January 2009 #

    you are right – that correction needs making in 2 more places i think to make it clean.

    the new “unexpected ‘)’” etc errors are likely due to mistakes in widget logic code you are now trying in the widget interface. check all your widgets (on all your sidebars if you have more than 1) for widget logic code and check their syntax. somewhere there is a stray bracket or something like that.

  13. Matteo on 22 January 2009 #

    Ok, things are loooking up :)

    I couldn’t find any stray brackets and was on the verge of giving up in despair, but I decided to see if a fresh install of the plugin would work now that the bad data seemed to have been cleared. It did help!

    Now there are no error messages when saving and I’ve been able to exclude single pages but when i try

    !is_page(array(’page-name’,’other-page-name’))

    this appears in the sidebar

    Parse error: syntax error, unexpected $end in /usr/home/seobcn/www/wp-content/plugins/widget-logic/widget_logic.php(132) : eval()’d code on line 1

    Is there any thing else I can do? Or any other code i can try which will produce the desired effect?

    Thanks Alan!

    Matteo

  14. Alan on 22 January 2009 #

    are you perhaps copying that code from here and that includes the curly quotes? if so, replace with simple straight quotes.

  15. Matteo on 22 January 2009 #

    That was it! Thanks so much for all your help :)

    Matteo

  16. emirie on 4 February 2009 #

    I like this plugin however I’m having problem how can I exclude one page? I mean I want the widget to appear on every post or pages except my about page. Any ideas?

    Thanks in advance.

  17. admin on 4 February 2009 #

    see comments 11-12 above

    there are more examples and explanations on

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

  18. emirie on 5 February 2009 #

    I tried to put !is_page(‘about’) on one widget logic to exclude that widget on my about page but I’m getting this error:

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/erikawor/public_html/wp-content/plugins/widget_logic.php on line 29

    Warning: Invalid argument supplied for foreach() in /home/erikawor/public_html/wp-content/plugins/widget_logic.php on line 29

    Warning: Cannot modify header information – headers already sent by (output started at /home/erikawor/public_html/wp-content/plugins/widget_logic.php:29) in /home/erikawor/public_html/wp-includes/pluggable.php on line 850

    Please let me know what to do. Thank you again.

  19. admin on 5 February 2009 #

    ok, that is a new issue that i think is the same as matteo’s above (see comments 59-62). no idea where its coming from, but it needs a proper fix – so i need to put this in the code permanently. You can try the quick fix suggested above, or wait for the plugin update. prob get that out by the end of the week.

  20. admin on 5 February 2009 #

    emirie, i have updated the ‘development version’ on the WP site, which will be available to download shortly here. (it should say it’s v 0.45 at the top of the main php file if you need to check)

    your problem should be dealt with by those fixes. let me know how it works out, and if all is well. i will do another minor official update.

  21. emirie on 6 February 2009 #

    Its works very well now and the widget shows the way I wanted to. As of now I don’t have any error or problems.
    Thank you very much.

  22. admin on 6 February 2009 #

    Terrific! and thank you for checking back and letting me know. i will release it officially over the weekend.

  23. lorenzo on 12 February 2009 #

    Hi Allan,
    very nice and helpful plug!

    I’ll have a couple of question on this plugin,not really
    an assistance request.

    A- would this ‘work’ to call inside my WP
    the SSI of my */forum? (recente comment,or else)

    B- would be possible to set More than 1 page in
    the Widget Logic dedicated field?

    Thanks for sharing your work and knowledge .

    ciao

  24. admin on 12 February 2009 #

    sorry Lorenzo, i’m not really clear on what you are asking in ‘A’.

    In ‘B’ i take it that you are asking if it can make widgets appear in multiple pages, and yes it can, by using OR which is written ||

    is_page(‘about’) || is_page(‘credits’)

    would make a widget appear on both those pages

  25. lorenzo on 12 February 2009 #

    Many thanks,
    and sorry for my bad english

    the A: question was about the ability of your plug
    to call within WP some SSI declarations
    Those SSI are about a SMF located in the domain subdomain (while WP is ‘root’)

    I’m Asking it because I’ve already tied out a different plug but I do find it a bit too pervasive.

    MAny many thanks again.

    lorenzo

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)