1
votes

I'm trying to use Widget Logic (wordpress plugin) to display a widget when viewing a post that is posted to a certain category. I've used:

is_category('category_name')

To display it on the categories archive, but when viewing an individual post, it is no longer displayed.

Is there a wordpress condition tag that does what I want?

3

3 Answers

2
votes

An easy solution would be to create a special "sidebar" http://codex.wordpress.org/Function_Reference/dynamic_sidebar and wrap it in is_category().

Edit: Haven't used Widget Logic but by looking at examples this should work

(is_single() && in_category('baked-goods')) || is_category( 'baked-goods' )

0
votes

I wouldn't recommend editing the WordPress core files but you can probably edit the plugin directly. You will need to find where the plugin calls the function to output the widget and add if(is_category('Category A')) { and add the } after the call to the function.

Here is the link to the is_category() in the WP codex for reference.

0
votes

Try in_category():

<?php if (is_category('category_name') || in_category('category_name')) : ?>

    // widget markup

<?php endif; ?>