Using a hook to add a div within a div?

Community Forums Forums Design Tips and Tricks Using a hook to add a div within a div?

This topic is: resolved

Tagged: ,

This topic contains 4 replies, has 2 voices, and was last updated by  Tony @ AlphaBlossom 1 year, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19026

    godinternational
    Participant
    Post count: 5

    Hi, relative noobie here. I’ve tried searching the forums but could not find what i was looking for, so maybe i am not asking correctly.  I am using the minimum theme, and what i would like to do is add a new div inside the header that wraps both the widget area and the menu. There is currently the generic div with class “Wrap” but i cannot edit this in the css without changing the entire site, so i either need to change the class on that div or create a new div that will function the same way. I cannot figure out how to do either.

    Here’s my site. http://abigailosteen.com/home

    I used this code below to successfully re-wrap the header but now i am looking to insert a div within the header. hopefully that makes sense.

    Thanks in advance!
    /** Adds New Wrap around header */
    function header_div() {
    echo '<div class="header-wrap">';}
    add_action( 'genesis_before_header', 'header_div' );

    #19067

    godinternational
    Participant
    Post count: 5

    I guess the code above just puts a new wrap around everything. Not at all what i was trying to do. Guess that means I am starting with nothing.

    #19100

    Tony @ AlphaBlossom
    Participant
    Post count: 341

    You said “There is currently the generic div with class “Wrap” but i cannot edit this in the css without changing the entire site”…I”m not sure I understand correctly, but if you can use css with the existing wrap, it’s a lot easier than trying to add an extra div inside the header.

    You can target the existing header wrap specifically which will not affect any other .wrap divs on the site.

    To target only the header wrap, you would use:

    #header > .wrap {
    }

    Will that work for what you’re tying to do?


    Tony Eppright | http://www.AlphaBlossom.com | @_alphablossom

    #19169

    godinternational
    Participant
    Post count: 5

    YES! thank you i completely forgot about the ability to target a specific class within a div. I am curious though would the only other way to have accomplished what i was talking about be to make my own custom header?

    #19701

    Tony @ AlphaBlossom
    Participant
    Post count: 341

    I’m happy to help!

    I’m not aware of any other way to do that other than a custom header.


    Tony Eppright | http://www.AlphaBlossom.com | @_alphablossom

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

You must be logged in to reply to this topic.