user definable sidebar per page

There’s a brute force method you can use.

When you register your sidebar, you give it an ID and a name, then you use that ID and name on the sidebar template to display it.

What if you appended the ID of the page to that identifier? So instead of ‘mainsidebar’ you had ‘mainsidebar’.$post->ID?

Step 1: In functions.php do a WP_Query loop to grab all the pages. Instead of displaying the posts however, register a sidebar, and append the posts ID to the identifier. Append its title to the pretty name so your not looking at numbers in the admin panel
Step 2: In your page template modify your sidebar call to include the post ID on the end like you did earlier.

Advantages:

  • Every page has a sidebar unique to it
  • Total control over what goes where
  • Simple quick and easy implementation

Disadvantages:

  • Doesn’t scale. 100 pages means 100 sidebars, you’ll have to be a bit more selective, perhaps a post meta toggle that you can filter on in the WP_Query registration loop
  • Shared content becomes tedious to re-enter for every page. This can be avoided by having another sidebar that they all share that isn’t per page.