add a class to the sidebar div

Community Forums Forums Design Tips and Tricks add a class to the sidebar div

This topic is: not resolved

Tagged: 

This topic contains 7 replies, has 3 voices, and was last updated by  Jen Baumann 2 years, 7 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #562

    micharo
    Participant

    How do I add a class to the sidebar div with the name of the specific sidebar displayed?
    <div id=”sidebar” class=”nameofthesidebar”></div>

    • This topic was modified 2 years, 7 months ago by  micharo.
    • This topic was modified 2 years, 7 months ago by  micharo.
    #570

    Jon Weiss
    Moderator

    What exactly are you trying to accomplish? Are you trying to modify the css of a sidebar on various pages?


    #629

    micharo
    Participant

    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.

     

    #696

    Jen Baumann
    Keymaster

    Are you using simple sidebars?

    #732

    micharo
    Participant

    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?

    #739

    Jen Baumann
    Keymaster

    It all depends on how you do things. There’s more than one way to skin a cat, but if you do it this way, then it is easy to add a class to the sidebar markup.  As for Simple Sidebars, send me a message. I may have something for you to test.

    #795

    micharo
    Participant

    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?

    Thanks again.

    #819

    Jen Baumann
    Keymaster

    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.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.