There are (among others) two common ways of customizing the sidebar on an individual post:

  1. Create a new sidebar for the post, using code or plugins like Custom sidebars, WP Custom Sidebar, Per Page Sidebars, or similar.

  2. Create conditional display rules on individual widgets, using plugins like Widget Logic or Conditional Widgets.

Option 1 can lead to a proliferation of sidebars on your Widgets page if you have more than a few posts you want to customize. Option 2 can quickly lead to long, complicated, and difficult-to-manage sidebars in the backend. And with both 1 and 2, the user has to manage things on a separate page than the page she wants to customize.

So:

Are there any plugins—or related attempts—to add a sidebar/widget editor, (like in Appearance » Widgets) to the post edit screen? The idea would be to give the user the option to override the default sidebar on a given page in a convenient and intuitive way.

It might work something like this:

  • Add a metabox containing a checkbox to override default sidebar on that post or page.
  • If checked, display interface to select widgets. (this could be the full widget ‘bank’, but, more economically, it could just be a dropdown with names of widgets).
  • For the interface and saving, recycle code from Appearance » Widgets
  • For front of site, include filter to replace the default sidebar if _override_sidebar meta field says so.

I’m surprised I can’t seem to find a plugin for this. Do you have suggestions—plugins, pitfalls, related code?

enter image description here

3 s
3

I’m sure there is a more elegant approach (I’d love to know about!). Anyhow: I’d like to offer a solution.
You could create a default sidebar with default widgets and a custom sidebar with all available custom widgets. Then you use a combination of the following plugins: simple fields and widget logic to only show a selection of widgets.

How to:

  1. Fill the default sidebar, add a condition that shows this sidebar only if a certain metadata value is NOT set.
  2. Fill the custom sidebar with all optional widgets, add a condition to every widget to show up only if a certain metadata field is available
  3. Set up simple fields to write the conditional metadata

This way works quite well for me, though it is not very pretty.

Hope it helps or gives ideas for further extension.

Leave a Reply

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