post-page

Create Dynamic Sidebars

19
responses
by
 
on
June 2nd, 2008
in
LinkyLoo

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?

heading
heading
19
Responses

 

Comments

  1. Daniel (1 comments.) says:

    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 .

  2. Denis (1 comments.) says:

    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.

  3. nomad-one (1 comments.) says:

    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/

  4. chaoskaizer (2 comments.) says:

    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.

  5. 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

  6. kim (6 comments.) says:

    comrade: no i dont thing ‘that sort of granularity and control exist’ yet lol

  7. Rick Beckman (15 comments.) says:

    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.

  8. Neil (30 comments.) says:

    This is exactly what i was looking for, thanx guys ;)

  9. Ted Liptak (4 comments.) says:

    Good news are coming, thanks.

  10. palPalani (1 comments.) says:

    thanks, this is i’m looking for very long time.

  11. Sunny (2 comments.) says:

    @ 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.

  12. Azmeen (14 comments.) says:

    Sounds like what my Section Specific Text Widget was born to do :)

  13. Inspirasi bisnis says:

    Sorry I’m newby on wordpress, could tell me how can I create a dynamic sidebar as simple as we can?

  14. Jeff Chandler (295 comments.) says:

    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.

  15. Richard H (3 comments.) says:

    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.

    …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…

    Yes, use is_page(‘contact’) or is_page(‘about’).

    Thanks for the support Jeff.

  16. Scott Gostyla (1 comments.) says:

    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

  17. nasir (2 comments.) says:

    you ppl solved my problem….thanks!



Trackbacks/Pingbacks

  1. [...] Creating Dynamic Sidebars in WordPress [...]

Obviously Powered by WordPress. © 2003-2013

page counter
css.php