Recently, a client with a custom WordPress site we built wanted to display different text in a single sidebar widget on each top level page so when a visitor clicked through the navigation, the sidebar content in that one particular widget would change. This can be accomplished in many ways, but one solution is through the use of the WordPress plug-in Widget Logic.
The plugin gives every widget an extra field where you can use WordPress’ conditional tags to control what page(s) your widgets appear on.
- You want a widget only to appear on your about page but not any others
- You want a video in the sidebar to auto play on the home page, but not on any other page
- You want a different testimonial to show up in the testimonial widget on each page
- You want to offer different opt-in offers on different website pages
- You want to display a specific widget only on posts by a certain author or in a specific category
With Widget Logic, you can drag a new widget into your sidebar, add the conditional tag is_page( ‘about’ ), and the widget you just created will only appear on the about page.
For this example, you would need to create a different widget for each page and assign each widget to each page using a conditional tag. I would use the WordPress page ID conditional tag is_page( ’45’ ) changing the number for each widget to match the actual page ID you want the widget to appear on. Through the use of WordPress’ conditional tags you can also specify unique widgets at a broader scale such as pages, posts, templates, authors, categories, tags, etc.
As a reminder, before installing and testing a new plugin that you are unfamiliar with, completely back-up your WordPress files and database in case your theme isn’t compatible.