Community Forums › Forums › Archived Forums › Design Tips and Tricks › Unexpected behavior with hooks
Tagged: hooks header move priority
- This topic has 3 replies, 2 voices, and was last updated 10 years, 10 months ago by macaines.
-
AuthorPosts
-
June 18, 2013 at 10:42 am #46557macainesMember
Hi all...
First post...new with Genesis but liking it so far.
Looking for some insight as to why I'm getting the following behavior with some hooks implementation...perhaps I'm going about this the wrong way and would appreciate some assistance.
Essentially, I'd like to modify the Genesis Sample theme as follows...
Before...
<div id="wrap"> <div id="header">...</div> <div id="nav">...</div> <div id="inner">...</div> etc...
After...
<div id="header">...</div> <div id="wrap"> <div id="nav">...</div> <div id="inner">...</div> etc...
This modification based on my Googling is pretty straightforward by adding the following code to functions.php
/** Reposition header outside main wrap */ remove_action( 'genesis_header', 'genesis_header_markup_open', 5 ); remove_action( 'genesis_header', 'genesis_do_header' ); remove_action( 'genesis_header', 'genesis_header_markup_close', 15 ) ; add_action( 'genesis_before', 'genesis_header_markup_open', 5 ); add_action( 'genesis_before', 'genesis_do_header' ); add_action( 'genesis_before', 'genesis_header_markup_close', 15 );
Here's where it gets a bit wonky...if I were to try to add another new div called pre-header above the header area, so that it looks like this...
<div id="pre-header">...</div> <div id="header">...</div> <div id="wrap"> <div id="nav">...</div> <div id="inner">...</div> etc...
...I would assume that I could define a custom function like this in functions.php...
function do_preheader()
{
printf( '<div id="pre-header"></div>');
}...and add the following hook to functions.php...
add_action( 'genesis_before', 'do_preheader' );
but instead what I end up getting is this...
<div id="header"> <div id="wrap"> <div id="pre-header"></div> <div id="title-area">...</div> <div id="widget-area">...</div> </div> </div> <div id="wrap>...</div>
Perhaps I'm way off here...perhaps there's a technique I'm missing or not yet aware of....thanks for any insight or help with this!!
Michael
June 18, 2013 at 10:57 am #46565Brad DaltonParticipantHi Michael
What exactly do you need to do?
Are you running HTML 5?
June 18, 2013 at 11:16 am #46571macainesMemberHi Brad,
I was a bit long-winded with my post...:)
Essentially I would like to move the header area outside of the wrap div and add another div on top called pre-header like so...
<div id="pre-header">...</div> <div id="header">...</div> <div id="wrap"> <div id="nav">...</div> <div id="inner">...</div> etc...
I'm running Genesis 1.9.2 so I don't believe that it's fully Html5
Thanks,
MichaelJune 19, 2013 at 8:56 am #46743macainesMemberI found the problem...
It was a priority issue with the hooks being called.
I changed
add_action( ‘genesis_before’, ‘do_preheader’ );
to
add_action( ‘genesis_before’, ‘do_preheader’,1 );
and the expected results occurred.
Michael
-
AuthorPosts
- The topic ‘Unexpected behavior with hooks’ is closed to new replies.