Truly Dynamic Sidebars (WordCamp Raleigh 2012) | Web Development Services by Ed Nailor
Sidebars have been around for a while and are a great part of WordPress. We can have multiple instances of widget areas in various places (sidebars, footer, header… pratically anywhere you want to put them!) We can use widgets over and over again… if you want 5 widgets of Recent Posts, so be it! And with Widget Memory, your widget areas will be remembered if you change themes so they are available if you come back to that theme. All very cool stuff!
However, widget areas are not without drawbacks. The same Sidebar / widget area is used throughout a theme, with exception of a specific template (such as a Full Width template.) Adding more sidebars and widget areas requires some programming skills. And since most of my websites are built specifically for a client, my clients generally have need for features such as per page control of widgets, widget areas that are easy to manage and widget areas that can be added on the fly without programming skills.
In looking for solutions to help my clients, I looked at plugins and creating theme templates. Even the best of the plugins, such as Widget Logic and Widget Logic Visual required some advanced programming understanding are were still somewhat confusing, especially when dealing with lots of widgets. Ever had a widget area with 30+ widgets? Yeah, that can get confusing. Theme templates can help by creating specific widget areas for that template, but none of these approaches allowed a client to add a new widget area to the site easily.
This is where I came up with…
This solution is very scalable, allowing the site to grow as needed. It allows for easier management of multiple widget areas (gone are the days of 30+ widgets in one location!) There is no advanced programming skills needed and the client can add new widget areas on the fly!
Take a look at these screenshots:
The code for this is located at https://github.com/ednailor/TrulyDynamicSidebars. Feel free to dissect the code and use as you wish. The code is commented out fairly well.
The presentation is located at http://www.slideshare.net/ednailor/truly-dynamic-sidebars-for-wordpress.
You can view the video of the presentation which I have posted to Truly Dynamic Sidebars for WordPress – Presentation Video.
As a Reminder, a plugin version of this should be coming soon. Let me know if you’d be interested!