Community Forums › Forums › Design Tips and Tricks › Using a hook to add a div within a div?
Tagged: Div, inside div
This topic contains 4 replies, has 2 voices, and was last updated by Tony @ AlphaBlossom 3 months, 1 week ago.
-
AuthorPosts
-
February 8, 2013 at 1:51 pm #19026
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' );
-
This topic was modified 3 months, 1 week ago by
godinternational.
-
This topic was modified 3 months, 1 week ago by
godinternational.
February 8, 2013 at 3:11 pm #19067I 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.
February 8, 2013 at 4:39 pm #19100You 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
February 8, 2013 at 10:43 pm #19169YES! 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?
February 11, 2013 at 3:54 pm #19701I’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
-
This topic was modified 3 months, 1 week ago by
-
AuthorPosts
You must be logged in to reply to this topic.