Dynamic Page-Specific Sidebars
-
I’m not sure that’s the most descriptive title, but hopefully someone will be able to give some thought to this problem. I’m building a site, using WP as a CMS, for a less-than-technical client and I’m trying to streamline the administration as much as possible.
She wants to have a different sidebar for each section of the site which is easily accomplished by editing functions.php and adding the additional sidebars. In the past I have created 5 different templates (one for each section) that pull in the required sidebar. The only problem with this is that my client would need to specify a template for each page she creates and while I can train her on how to do it, I was wondering if there was a more… elegant solution.
Is there a way to pull the ID of the page and test to see what the parent of that page is so that I can then load the sidebar corresponding to the parent’s ID? For example, if the About page’s ID is 12 and I’m on /about/history, the template would display “sidebar-12”
I’m grateful for any advice or suggestions you may have!
- The topic ‘Dynamic Page-Specific Sidebars’ is closed to new replies.