Richard Hooper of WP Project.com has published an interesting post which explains how to create dynamic sidebars. As it stands, there is no way to assign widgets to only appear on specific pages of your WordPress Powered blog in the back end. Using Richard’s method, you can create your own sidebar.php file and assign various widgets or plugins to only show up on specific sections of your blog. This is great if you want to display a widget on a SINGLE post template versus the front page.
Richard also adds that
Aside from creating a dynamic sidebar, this approach breaks up your sidebar code into smaller, more manageable chunks.
Perhaps we should coax Richard into turning this into a plugin in which normal users can then assign widgets to appear on certain page templates.
Here is a question I have. You can use this method to assign plugins/widgets to appear on page templates, but outside of hardcoding those templates, can you manually assign widgets to appear on certain pages without having to place PHP code into the page itself. For example, if I have an about page, and I have a contact page, is there a way to assign a widget to show up on the about page but not the contact page, even though they are both on the same page template. Does that sort of granularity and control exist?
You might be interested in using my plugin. It is called Core Sidebars and it allows you to assign widgets / sidebar content to specific pages or posts. It has the dynamic sidebar capability that you are possibly looking for. Available at the WordPress directory .
The Widget Logic plugin gives every widget an extra control field called “Widget logic” that lets you control when the widget appears.
In the Admin/Design/Widget, all you need to do is type
is_page('about')
into that extra field of the desired widget.I found a plugin called widget logic which does exactly that, it allows you to control when and how widgets are displayed. Check it out at – http://wordpress.org/extend/plugins/widget-logic/
interesting,I’ve implement dynamic sidebars (& widgets) base on wordpress template hierarchy (i.e, single, page, archive) in all my theme.
here some live example at kakkoi & its POSH too.
You might also want to check out Daiko’ Text Widget as it will let you specify the pages you want it to show the content on. IT also supports PHP code
helps if I remember the URL eh ๐
http://www.daikos.net/widgets/daikos-text-widget/
comrade: no i dont thing ‘that sort of granularity and control exist’ yet lol
There’s also Sidebar Modules – http://nybblelabs.org.uk/projects/sidebar-modules/ – which is a replacement of the Widget functionality. It provides fairly granular control.
This is exactly what i was looking for, thanx guys ๐
Good news are coming, thanks.
thanks, this is i’m looking for very long time.
@ Jeff
There is a simple way to assign widgets to a particular page using conditional tags, refer to Codex. It gets better, you can create much more complex dynamic array funtions with 2.5.x, I have a “how to” with a demo on my site.
Sounds like what my Section Specific Text Widget was born to do ๐
Sorry I’m newby on wordpress, could tell me how can I create a dynamic sidebar as simple as we can?
Just wanted to say thank you to each and every one of you for highlighting the various plugins which perform this duty. I didn’t know any of these existed.
As far as plugins are concerned, there are many that manage this idea in one form or another, as you can see by the comments here.
Personally, I try to avoid plugins wherever possible—which is why I share these simple code hacks as I implement them on WP Project.
Yes, use is_page(‘contact’) or is_page(‘about’).
Thanks for the support Jeff.
This is really nice. I’ve seen a couple of complicate quality themes that did this, but I was wondering how to do it for my own these. Thanks
you ppl solved my problem….thanks!