Easily Show or Hide Widgets on Specific WordPress Pages or Posts
We all want every page of our website unique and enticing. One of the things we do is to place compelling posts that help us achieve user engagement. We make sure that they find something useful. Moreover, not only should every page or post be interesting. It should also be functional. Thus, we add widgets that help serve this purpose. However, some widgets may not be appropriate in certain pages or posts, so we hide them from those places. This can mean laborious coding work if you have not heard of this WordPress plugin called Widget Options by PHPBITS Creative Studio. This free plugin lets you easily show or hide widgets on specific WordPress pages or posts minus the tedious coding work.
HOW TO SHOW OR HIDE WIDGETS ON SPECIFIC WORDPRESS PAGES
Here’s a very simple procedure for hiding unwanted widgets or showing relevant ones on certain pages.
Step 1. Download your free Widget Options and let it do most of the job. From your WordPress dashboard, click “Plugins > Add New”. In the “Add Plugins” page, type “Widget Options” into the Keyword Search field, as shown in the image below. Click “Install Now”. When the download is finished, you should be able to see the “Activate” button. Activation takes only a few seconds and your plugin is ready to use.
Before you continue with the very easy widget tweaks, you may want to look at Widget Options’ amazing features. Among them are pages visibility, device restriction, and custom alignment. Just go to “Settings” and click “Widget Options”.
Now, let’s carry on showing/hiding pages.
Step 2. From the “Appearance” tab on your WordPress dashboard, click “Widgets”. You should be able to find the list of your active widgets there.
For my example, I’m going to hide from a couple of my pages the “recent comments” widget found in the sidebar.
Step 3. Click on the widget to reveal the options and go to the visibility tab (the “eye” icon”).
Step 4. From the Hide/Show menu, choose “Hide on Checked Pages”.
Step 5. Look for the list of pages under the “Post Types” tab. Tick the boxes next to the pages you want the widget hidden from.
Step 6. Make sure you save all the changes before leaving the page to check your site.
HIDING/SHOWING WIDGETS FROM SPECIFIC WORDPRESS POSTS
How about hiding or showing widgets from specific posts? Unlike pages, posts are not listed anywhere in the Widget Options. Before you can hide or show widgets from posts, make sure you have taken note of the post IDs. To locate your WordPress Post ID, hover over the “Edit Post” in your WordPress dashboard, as shown in the image below to reveal the Post ID at the bottom of your browser.
Now, again, for my example, I am going to hide the “recent comments” widget from two of my posts. Let’s go through these three easy steps.
Step 1. Click on the widget to reveal the options, then locate the “Class, ID & Logic” tab (“gear” icon). In it, you will find the “Logic” tab.
Step 2. In the text field, type in the following, which includes the Post IDs (84 and 64 are the IDs of the posts I’m hiding the widget from):
The conditional code above lets me hide widgets on multiple posts. Alternatively, to show multiple posts instead, I use
To hide and show widget on single post, use
!is_single( ’84’ ) and is_single( ’84’ ), respectively.
Step 3. Don’t forget to hit the “save” button before leaving the page!
Try it out and see for yourself. You will see how easy it is to show or hide widgets on specific WordPress pages using the Widget Options plugin.
About the Author
Name: Bernadette Lee
Bio: Bernadette is the Content Marketer for PHPBITS Creative Studio which offers free WordPress Plugins. She’s a food enthusiast and a big fan of American Bluegrass.