WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my (page-only, no posts) Wordpress site I have a number of static blobs in need to put in a sidebar. We could call/tream thoses 'blobs' as widgets. At least they'll have a fixed html content, like 'teaser1', 'teaser2', 'disclaimer', 'foo policy'...

What I need, is to arrange them differently for every page. So this is not just about 'single' vs. 'archives', but truly 'product page A' vs. 'product page B' vs. 'about us' vs. 'terms of service'...

I was thinking about custom meta boxes to turn them on and off on the individual editor page wp-admin/post.php?post=196&action=edit, but of course the drag-and-drop comfort and easy order determination of regular widgets would be even nicer.

Also I am unsure how to maintain (add, remove, edit (html text view will do) those static snippets...

It would be more intuitive for my users to have it on the individual edit page (wp-admin/post.php?post=123&action=edit) to check "I want widget 1,2,5,8" rather than going to the respective widget/snippet, telling him "You have to appear on the following pages" which I understand is the way Display Widgets works...

So ideally I'd have a Widgets (or Modules or Snippets) preference page, where I can add/edit/delete widgets. And then on the individual edit page, a metabox on the right to add them and drag them into order.

share|improve this question
While interesting question, it also seems to be very very custom use case. Your choice are probably either going with more generic approach such as existing plugins suggested (I will also throw in WooSidebars) or [hiring someone for] coding this from scratch. – Rarst Mar 1 '13 at 17:19
up vote 4 down vote accepted

You can do it using Widget Context plugin or Widget Logic plugin.

They work fine. I prefer Widget Context because it has more flexibility.

share|improve this answer

What about using something simple like a plugin.

I'm using Widgets Controller and it's a good one.

A plugin that give you control for show or hide widgets on WordPress Categories, Posts and Pages.

share|improve this answer

This plugin http://wordpress.org/extend/plugins/wp-page-widget/ is very good and here're some screenshots and more info about it http://codeandmore.com/products/wordpress-plugins/wp-page-widget/. Used it on quite a few sites and never had any issue.

The best thing about it is that you can actually manage the widgets for each specific page on the page's editing screen without needing to go to the widgets area.

share|improve this answer

I did this for a specific template on a site. Any page with that template got its own widget zone, allowing one or more widgets specifically for that page. There are several plugins that give you dynamic widget logic, but this approach is more targetted and might suit your problem (it did mine on that specific website).

For the admin, the widget zones must all be registered so that you can assign and configure widgets for those pages:

// dynamically add some widget zones for pages using some templates
add_action('sidebar_admin_setup', 'wpse_76601_actionSidebarAdminSetup');

* handle action sidebar_admin_setup to check for dynamically created sidebars
* and make sure they're registered
function wpse_76601_actionSidebarAdminSetup() {
    global $post;
    global $wp_registered_sidebars;

    // find all pages that use template with dynamic widget zone
    $query = new WP_Query(array(
        'meta_key' => '_wp_page_template',
        'meta_value' => 'wpse-template-dept.php',
        'post_type' => 'page',
        'nopaging' => true,
        'orderby' => 'title',
        'order' => 'ASC',

    while ($query->have_posts()) {

        $id = "wpse-{$post->ID}-aside";

        // register any that aren't already registered
        if (!isset($wp_registered_sidebars[$id])) {
            register_sidebar( array(
                'name' => $post->post_title . ' Asides',
                'id' => $id,
                'description' => 'Aside widgets for page ' . $post->post_title,
                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
                'after_widget' => '</li>',
                'before_title' => '<h3 class="widget-title">',
                'after_title' => '</h3>',
            ) );

Then in the page template, the widget zone must be registered again before being called; just add at the top of the template before the call to wp_head(), and it will register for that specific page only.

function template_widgetsInit() {
    global $post;

    register_sidebar( array(
        'name' => $post->post_title . ' Asides',
        'id' => "wpse-{$post->ID}-aside",
        'description' => "Aside widgets for page {$post->post_title}",
        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>',
    ) );
share|improve this answer

Are you talking about reordering them or simply toggling which one(s) are displayed on a per-page basis? You could certainly add a taxonomy and have each widget listening for the presence of that term (in sidebar.php, for example).

For example, the registered taxonomy could be called "Widget Presence" and has terms like Widget 1, Widget 3, About Us Text, Foo Bar.

A page will select which terms it has.

In sidebar, you'd have some conditional statements which check to see which terms any given page has, and load template parts or specific widgets or blocks of code that correlate. Make sense?

I could prepare a more specific example if you want to provide more specifics.

share|improve this answer

Couldn't each page have a different page template, and each of those page templates have a different menu? I assume there is a limit to the number of menus you can create, would be the biggest limitation.

share|improve this answer

I have built a website with these same needs. I actually just uses the plugin "Widget Logic"


It creates text field on each widget that takes Wordpress conditional tags. If I needed to reorder them i created more than one of the widget that was needed in separate locations. It was a fast an easy fix.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.