Install and active the Widget Logic plugin.
The Widget Logic plugin allows you to use Wordpress' conditional tags to specify if the widget should be shown or not.
Widget Logic gives us one field to work with. In it you can use Wordpress conditional tags or actual PHP code. This is a little more advanced and not recommended if you don't know what you are doing. Also, anyone with access to your dashboard will actually be able to run scripts through this box. This means they can run malicious code if they please.
Here are some of the things you can try out with this plugin.
- Show on single post: is_single(1) - replace 1 with the post ID, slug or title
- Show on every page except one: !is_page(2) - replace 2 with the page ID, slug or name. ! returns true when the statement is false. It's kind of like saying "is not page with the id of 2".
- Show on single posts in the category calledCrazy Posts: is_single() && is_category('Crazy Posts') - && means and, you can also use|| which means or.
Well, I hope this training was enjoyable and more importantly helpful.
Join the Discussion
Write something…
nathaniell
Premium
I didn't even know this was possible. Easy to do and can make a blog more efficient. Thanks.