You are here: Home » WebTuts » How to Display Different Widget for Specific WordPress Page or Post

How to Display Different Widget for Specific WordPress Page or Post

Today, I will be showing you how to setup a different widget for specific page in WordPress. If you’re familiar with WordPress before, you should notice that WordPress only allow the same widget content for your whole site.

Step #1 Installing the Widget Logic Plugin

We need a plugin called Widget Logic to achieve this. Basically, this plugin lets you control which widget you want to display on each page of your site using short codes.

Download and install it in your WordPress site and activate the plugin once it’s installed.

Step #2 Using the Plugin

Go to Appearance > Widgets to start setup your sidebar.
Assuming that your theme already had a sidebar implemented, add any widget that you wish to add to your sidebar or other widgets holder as you desire. Here, I’m going to add some of my customs menus to show different submenus from every page.

wordpress widget logic

Step #3 Adding the Logic

Once done with adding in the widgets, expand one widget and look at the bottom option called ‘Widget logic’.

wordpress widget logic

Here is where you will add which page this widget will visible. Use below code to add a page and change the text ‘your page name’ to your page or post name.

is_page( ‘your page name’ )

To add multiple pages, just add ‘||’ between them. For example:

is_page( ‘your page name’ ) || is_page( ‘your page name’ ) || is_page( ‘your page name’ )

wordpress widget logic

That’s all! It should work now. Go visit your page to see the changes.

Leave a Reply

Your email address will not be published. Required fields are marked *