0
votes

I'm using the wordpress plugin, Widget Logic, to choose where a widget is displayed. It uses the wordpress conditional tags.

My question is: What wordpress conditional tag can be used to display on an individual post page, within a certain category? is_category() only displays it on the posts archive page, not when viewing a post from the same category itself.

1

1 Answers

0
votes
if (is_category( array( 9, 'category 1', 'category 2' ) ) || is_single()) {
    // your code here
}

Returns true when the category of posts being displayed is either term_ID 9, or slug category 1, or name category2 and is a single page

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