I am working on a genesis site where I need to move the standard nav menu to above the header. I'm using the following code in the functions.php file of my child theme:
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );
It's adding a nav menu before the header, but not removing the one after the header. The "after header" one is correctly placed in the output, so I know I'm using the correct hook on the "remove_action". There is nothing else in my functions.php file that is dealing with the nav other than specifying a menu for the footer and adding the descriptions. Below is all the code in my functions.php file (skipping a large section dealing with column shortcodes):
add_action('genesis_setup','child_theme_setup', 15);
function child_theme_setup() {
//Add Homepage Sidebar
genesis_register_sidebar( array( 'name' =>
'Home Sidebar', 'id' => 'home-sidebar' ) );
//Adds footer widgets
add_theme_support( 'genesis-footer-widgets', 6 );
//Adds Footer Text Replace
remove_action( 'genesis_footer', 'genesis_do_footer' );
remove_action('genesis_footer', 'genesis_footer_markup_open', 5);
remove_action('genesis_footer', 'genesis_footer_markup_close', 15);
add_action( 'genesis_after', 'be_footer' );
}
//Function to replace the footer text and copyright
function be_footer() {
echo '<div id="footer" class="footer"><div class="footer-wrap"><div class="left"><p>© Copyright ' . date('Y') . ' RC Auto |<a href="http://www.watrousmedia.com/">Watrous Media</a></p></div>';
echo '<div class="right">';
wp_nav_menu( array( 'menu' => 'footer' ) );
echo '</div></div></div>';
}
//Add Menu Descriptions
function be_add_description( $item_output, $item ) {
$description = $item->post_content;
if (' ' !== $description )
return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . '<span>' . $description . '</span><', $item_output);
else
return $item_output;
}
add_filter( 'walker_nav_menu_start_el', 'be_add_description', 10, 2 );
// Use shortcodes in widgets
add_filter( 'widget_text', 'do_shortcode' );
/** Move primary nav menu to before header for mobile support*/
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );
Here's a screenshot:
The Main menu is the styled one added in a widget as I needed it in the header. The main menu I am planning on using as the responsive mobile menu. Anyone know why the lower nav is not removing?
Thanks for your help.