Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Display widgets on specific posts only WordPress

  • SOLVED

I have a custom post type called 'Courses' and a bunch of posts within custom taxonomies.

I need to be able to display a different widget on each individual post under Courses.

I have widget logic plugin installed and it works fine for things like is_page() is_single() etc...

What must I use to target specific posts. If a post has an id of 202 what conditional statement do I need to use?

or is there a better way to do it?

Answers (2)

2011-09-15

Kannan C answers:

Try this

is_single(array(17,18,19));

Hope it work with widget logic also.


Kannan C comments:

For more information on is_single function http://codex.wordpress.org/Function_Reference/is_single


Dan | gteh comments:

yup works.. late night. i had a typo which is why it wasn't working.

thanks

2011-09-15

Jerson Baguio answers:

You can add a custom field in a post lets say: iswidgetenabled

answerable by yes/no in your post's custom field.

in your post page

you can use a statement like


if(get_post_meta($post->ID, 'iswidgetenabled', true)){
//display your widget shortcode here
}