- This topic has 7 replies, 3 voices, and was last updated 9 years, 10 months ago by .
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
How do I add a class to the sidebar div with the name of the specific sidebar displayed?
<div id="sidebar" class="nameofthesidebar"></div>
I have a few different sidebars. Some sidebars are used on many pages. In order to apply css on the sidebars, for example a background image, I want to address the specific sidebar directly. Therefore I try to add a class in the sidebar div with the name of that sidebar. I looked into genesis-structural-wraps but i think that is not the way to go.
Any help appreciated.
Are you using simple sidebars?
On some projects I add sidebars with php code, on other projects I use simple sidebars. As far as I can see simple sidebars does not add a extra class to the sidebar div - with the sidebar name.
perhaps there is a filter or so?
Thanks for the reply.
I will use it when I will do it with code. I don't know why I could not see that solution.
Another question: Why are you using genesis_structural_wrap in your example on your site?
Basically, just to maintain consistency with the standard Genesis sidebar markup. If you look at the Genesis sidebar.php, you'll see the same markup.
© 2022 WPEngine, Inc.