Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I’d like to have a plugin for a flexible sidebar/widget management. In fact, I want to give a user the possibility to choose which sidebar should be displayed per page/post.

I know there are many sidebar plugins out there. Unfortunately, I haven’t found one which cover all my wishes. So I’d like to code this on my own. Which of the following possibilities do you find is the best and most flexible? Or do you have other approaches?

Posibilities

  1. Hardcode the register_sidebar calls in a plugin/functions.php and add a metabox for the post_edit.php, post_new.php screens.

    • Not that flexible. If a user has 100 pages and every page should have a different sidebar, the user has to register additional sidebars manually.
  2. Same as Nr.1 but use a generic sidebar template with conditional tags to display the widgets. We could also use the plugin Widget Logic for a more granular filtering in the backend.

    • Good for a programmer or experienced WordPress user, but not for a normal user. The conditional tags must be mapped in a friendly manner. Also is_page(id) could create problems on multilingual sites, where posts of a different language are stored with another id.
  3. A flexible-sidebars Custom Post Type. Every post in this CPT is used in a generic sidebar-template to display the given content. The sidebar is also selected within a custom metabox. The user can add content to the sidebar with the default WYSIWYG editor which is a big plus.

    • Not a „real“ sidebar. Therefore widgets couldn’t longer be added on the widgets-subpage in the admin panel. We have to create an own metabox for widget-assignments.
  4. Modify the widgets-subpage in the admin panel to create/register your own sidebars in WordPress. Also create a generic widget with a default WYSIWYG editor. Content with attachments could easily be added to the widget and draged to the new created sidebar. The user could then choose this sidebar with a drop-down field in a custom metabox in the post/page admin screens. To display the sidebar, we need also a generic sidebar-template.

Conclusion

From my point of view, Nr.4 should do the trick. Are there any other possibilities? Or does this already exists in a plugin?

Thanks for your reply

share|improve this question
add comment

1 Answer

There's a extension called "Widget Logic". It adds a field to every sidebar widget in admin section where you can add a piece of php code that you can use to archive what you most likely need.

Its a bit cumbersome but works. For example you mention that for multilanguage site, you can still use "is_page" since you can also pass array for the function, like this: is_page(array(94,71,3)) .. With logic operators (and/or/not/xor) combined with you can archive any combination.

share|improve this answer
    
Thanks for your reply. As you can see on my second point, i've already looked at the Wiget Logic plugin. Unfortunately, the plugin should be used by non-programmers without html/php knowledge. –  rofflox May 3 '11 at 6:16
    
True, I didn't spot that. If you are willing to make some actual coding, id still use the widgetlogic but implement a better some sort of editor for which would present a user some sort of wizard that user can use to generate the code. –  rasjani May 3 '11 at 6:22
    
This could be very nifty. I've also found a sidebar generator plugin. Combined with a WYSIWYG widget and the Widget Logic functionality, this should work. I will let the question open, maybe some has a better approach for this topic. –  rofflox May 3 '11 at 7:27
add comment

Your Answer

 
discard

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.