Ways to Show Widgets Depending on Page or Post

An easy way to customise a WordPress website is to have a number of widget areas defined, and be able to drop widgets at will into those areas. What gives even more flexibility however is the ability to select whether widgets show or not on a per page or per post basis. To get this functionality, we have to rely on plugins, so we'll take a look at some of the best ones.
Table of Contents

Sponsored Ad

If you purchase through a link on our site, we may earn a commission.

An easy way to customise a WordPress website is to have a number of widget areas defined, and be able to drop widgets at will into those areas.

What gives even more flexibility however is the ability to select whether widgets show or not on a per page or per post basis. To get this functionality, we have to rely on plugins, so we’ll take a look at some of the best ones.

Widget Logic

widget logic

This plugin gives every widget an extra control field called “Widget logic” that lets you control the pages that the widget will appear on. The text field lets you use WP’sΒ Conditional Tags, or any general PHP code.

Download Widget Logic

Widget Ninja

widget-ninja-preview

A very user friendly widget plugin, probably has the best interface of all the widget control plugins out there.

  • eliminate the need for multiple sidebars
  • create complex logical statements with conditional tags to control widget’s visibility
  • 25 conditional tags, 11 with additional options
  • or, and, not logical operators
  • works with any custom or built-in widget
  • no code editing
  • intuitive and simple drag-n-drop GUI
  • extensive in-line help
  • has much more options and it’s easier to use than Widget Logic

Download Widget Ninja

Sidebar and Widget Manager

sidebar widget manager

  • Custom page layouts – widgetize a page, drop widgets in page content area
  • EasyΒ column interface for Widgetizing Pages – Check it out
  • Vertical or Horizontal widgets alignment
  • Replace any theme sidebarΒ with a custom one on any set of pages
  • UnlimitedΒ custom sidebars
  • Widget visibility – display any widget on or hide it from any page
  • Supports any kind of contentΒ Pages, Page templates, Posts, Categories, Tags, Archives, Custom post types, Taxonomies, Post type archives, WordPress service pages – home, front, 404, search, etc.
  • Optimized performance for large WP installations
  • Designed to fitΒ into the core WordPress design
  • Easy and intuitiveΒ administration
  • No codingΒ required

Download Sidebar and Widget Manager

Custom Widget Areas for WordPress

custom widget wordpress

Have you ever wanted to show different Widgets on Pages or Posts or even inside your content?

With the plugin you can create anΒ unlimited number of SidebarsΒ (Custom Widget Areas) and easily configure them by adding widgets in already familiar WordPress interface. You can assign the Custom Widget Areas to any of your themes defined β€œwidget areas”. You can even place them directly inside the content of Pages and Posts by simply using Shortcodes. We have also added support for Custom Post Types and Custom Taxonomies.

The plugin recognizes your themes default sidebars and allows you to replace them, as well as allowing you to set individual sidebars for basically any template in WordPress: Pages, Posts, Custom Post Types, Custom Taxonomies, Categories, Archives, 404 Page, Search Page, Attachment Page, Tag Page and Author Page.

Download Custom Widget Areas for WordPress

Per Page Widgets

per page widgets

Control widget areas on a per-page / per-post basis.

Gives you the ability to show or hide individual widget areas on each page / post as well as completely substituting the widgets shown in a specific widget area on a specific page or post.

Download Per Page Widgets

Widget Context

Widget Context allows you to specify widget visibility settings. It’s similar to Widget Logic but simpler, I would suggest trying this first before going for Widget Logic.

Download Widget Context

 

Per Page Sidebars

This plugin allows the creation and display of custom sidebars for any page (or post) on your site. On each page, you can choose which of your current theme’s sidebars will be replaced. The replacement works for all descendants of a replaced page.

In this fashion you can: 1. Easily create a CMS like site with unique sidebars for every page, even if your theme doesn’t support it. 2. Create a sidebar with a Cart widget that displays on store pages created by the WP-E-Commerce page, but not anywhere else on the site. 3. Use parent pages to create themed areas of your site, without creating custom page templates.

This plugin is compatible with every theme and all widgets because it hijacks your theme’s sidebars instead of replacing them.

Download Per Page Sidebars

If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.

Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Sponsored Ad

If you purchase through a link on our site, we may earn a commission.

All suggestions are anonymous.

More from our blog...

4 Responses

  1. There appears to be conditional widget logic without the need for a plugin, but I can’t get it to work with “tags”. I add a Text Widget, but I only want it to display in the sidebar when specific posts are displayed. I create a tag named “literature”. I add that tag to the posts for my book reviews.

    When I click Visibility when creating the Text widget, I select “Show” if “Tag” is “literature”. But when I display one of the book review posts that has that tag, the widget does not appear in the sidebar. If I specify “Show” if “Category” and select a specific Category I have created, this will work if I have selected that specific category. But the book reviews are in a sub-category and I don’t want to have to add conditions for each book review post I have. That is why I want to assign the same “tag” to each book review, and then conditionally display the widget only if the tag matches.
    Any suggestions?

  2. This is a great tutorial, im searing some widgets for my sites brightverge.com and gocime.com but still unable to search, manually I am creating but every time I edit my theme functions file I end up with an error message. I have double-checked it against what you put up above and can’t seem to resolve it.

  3. Hello, the point here is if you need to edit a theme that have to be delivered to some other website; it is impossible to keep all of the plugin dependencies the path you show for working with widget does not work in my case. Sorry.

Post a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay updated with WP Mayor's newsletter showcase every week

Stay on top of every new WordPress innovation and latest launches. Receive all our fresh product reviews and expert guides directly in your inbox.

Hosting Survey 2024

Are you happy with your hosting provider or are you over-paying for too little? Have your say below!

"*" indicates required fields

What's the main reason you picked this host?*
How happy are you with your host?*

OPTIONAL: If you'd like to receive the results of this survey, please enter your details below.