The Genesis primary navigation, or primary nav, is the main menu bar that usually displays between the site header and the main content area.
With a Genesis theme, it’s easy to change the position of the primary navigation to better suit your design, rewrite the function that outputs it or remove it altogether. For example, many Genesis themes reposition the primary nav above the header, and/or remove the primary nav as part of a Landing Page template.
The function responsible for outputting the primary navigation is
This function first checks that the child theme supports the Primary Navigation menu location and that a menu is assigned to the location. If so, it renders the primary navigation in either the HTML5 or XHTML format depending on the child theme. If the child theme also supports the semantic headings accessibility feature, the primary navigation is preceded by a semantic heading for screen reader users only.
genesis_do_nav is hooked to
genesis_after_header at the default priority 10.
Reposition the Primary Navigation
Below is the basic code to reposition the primary navigation to another hook. Just replace
another_hook with the name of your desired hook.
Rewrite the Primary Navigation
Below is the basic code to rewrite the primary navigation. Just replace
your_function_here with the name of the function that outputs your content.
Remove the Primary Navigation
The easiest way to remove the primary navigation across the whole site is to unassign the menu that is currently assigned to the Primary Navigation menu location, via the admin area or Customizer. Furthermore, you can prevent the primary navigation being re-added by removing theme support for the
To remove the primary navigation under certain circumstances only, below is the basic code that you can use in conjunction with the template hierarchy.
Example 1: reposition the primary navigation above the header.
Example 2: pop the primary navigation out of the
<div class="site-container"> (HTML5) or
<div id="wrap"> (XHTML) markup element.
The structure of the markup produced by the function
genesis_do_nav is as follows for HTML5 and XHTML themes respectively.
Genesis Simple Hooks
This function is not unhookable via Genesis Simple Hooks.
There are no filters on the output of this function.
genesis_do_nav has been included since version 1.0.0.
genesis_do_nav is located in lib/structure/menu.php.
- How to Move, Rewrite or Remove the Secondary Navigation with Genesis
- How to Insert Content After the Header or Nav with Genesis
- How to Add Extra Content Before the Site Header with Genesis
Relevant tutorials from the Genesis community.