Some times you may had felt the necessity to show certain ad’s only on Specific posts & hide them on all other posts.If you don’t have development Knowledge on WordPress then you may need to Hire an developer for doing the task.
Don’t think of hiring an developer I will show you how to control you’re Widgets display on your WordPress Blog.
In Short : Widget Logic lets you control on which pages,posts widgets appear using WP’s conditional tags. It also adds a ‘widget_content’ filter.Widget Logic plugin gives every widget an extra control field called “Widget logic” that lets you control the pages/posts that your WordPress widgets will appear on. The text field lets you use WP’s Conditional Tags, or any general PHP code.
Installing Widget Logic is easy & can be completed in few seconds as with any other plugin.After installing the plugin Activate the Plugin & move over to Appearance -> Widgets Section.
In this example I will show you How to control Display of an Adsense Widget, I want the Ad to Show only on Single posts & want to disable that on Home Page,Pages,Tag & category Archives etc.
- Drag a Text widget to the appropriate sibebar.
- Copy the Adsense Code into the Text Widget
- In the Widget Logic Text Box Below, enter the WordPress conditional tag is_single() & save the Widget.
Likewise you can control the Display of widget anywhere.If you want to display an widget only on Home Page use is_home().
Other WordPress Conditional Tags that can be used with Widget Logic :
Home Page :is_home()
Use this tag for displaying only on your Blog Main/Home Page.This Conditional tag doesn’t work if you set a static Page for the Front Page
Front Page :is_front_page()
Use this tag for displaying only on your front Page.
A 404 Not Found Page :is_404()
To Display on a page after an “HTTP 404: Not Found” error occurs.
A Search result Page :is_search()
To Display on a search result page archive.
Any Archive Page :is_archive()
To display on any type of Archive page. ie; Category, Tag, Author and Date based pages are all types of Archives.
Above are some of the WordPress conditional tags I use mostly for controlling Widgets on my WordPress Blog,there are more Conditional Tags that can be used along with Widget Logic WordPress plugin.You can get the complete list of Conditional Tags from here.
Readers thanks for reading the WordPress tutorial Patiently,please come back for finding more tips,tutorials on WordPress.