Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #503
    Jo
    Guest

    HI,

    I have installed this fantastic widget on http://www.premierweb.net.au.

    Is there a way to show the specific widgets on the individual post pages within the same category?

    e.g. I have restricted widgets to the category Article Writing. I also want these widgets to appear on all posts within this category.

    Can you please let me know how to do this?

    I tried using ‘Single Posts’ and ‘Blog Posts’ but it didn’t seem to work.

    Thanks

    #504
    Bartosz
    Keymaster

    Of course, you can achieve that using rw_display_widget() filter, for example if you want to display your widget on a category of ID 1:

    function custom_rw_display_widget ($display, $instance) {
    if (is_category(1) && $instance['title'] == 'Your widget title') { // change Your widget title
    $display = true; // or false if you want to hide it
    }
    return $display;
    }
    add_filter('rw_display_widget', 'custom_rw_display_widget', 10, 2);

    #507
    Jo
    Guest

    Thanks Bartosz.

    So I can’t set this up on the widget itself – i.e. using the ‘Display / Hide Widget’ function?

    I’m not clear on where I should add this code and whether it will show the widget information on all posts within the same category.

    Can you please clarify?

    Thanks

    #509
    Bartosz
    Keymaster

    No, you can’t do it that way. We just can’t handle all the possible variations in widget options. But using a filter allows you to set up literaly ANY conditions you need.

    Just add this to your theme’s functions.php and adjust to your needs using WordPress conditional tags http://codex.wordpress.org/Conditional_Tags

    #513
    Jo
    Guest

    Got it ! Thanks for your help!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.