How to Add Footer Navigation in Genesis Framework (HTML5)

By default, Genesis Framework comes with 2 navigations, referred as primary navigation and secondary navigation.

In this tutorial we’ll show you how to add a footer navigation or menu to your Genesis child theme. Please note that since this is theme-specific feature, the code below should go into your child theme’s functions.php file. This code assumed that you’re using HTML5 version of Genesis Framework and therefore we’ve also included the schema.org markup to be consistent with other elements in Genesis Framework. If you’re new to Schema.org, we’d suggest to read the article on Yoast.com on the importance of Schema.org.

1 2 3 4 5 6 7 8 9 10 11 12 13
<?php
//* Register Footer Menu in Genesis Framework (HTML5)
function afn_add_footer_menu () {
echo '<nav class="nav-footer" role="navigation" itemscope itemtype="http://schema.org/SiteNavigationElement">';
wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_id' => 'nav-footer' , 'menu_class' => 'menu genesis-nav-menu menu-footer', 'theme_location' => 'tertiary', 'depth' => '1' ) );
echo '</nav>';
}
add_action('genesis_before_footer', 'afn_add_footer_menu');
//* Add support for footer menu
add_theme_support ( 'genesis-menus' , array ( 'primary' => 'Primary Navigation Menu' , 'secondary' => 'Secondary Navigation Menu' ,'nav-footer' => 'Footer Navigation Menu' ) );
view raw functions.php hosted with ❤ by GitHub

The first part of the code registers the footer navigation. We intentionally set the depth parameter to 1 to make sure the navigation does not display any dropdown. Since we hook this in genesis_before_footer, the navigation will be displayed before footer credit and after widgetized footer section. Using Genesis Framework, you’re lucky since you can easily reposition it to any desired location using the right Genesis hook.

The second part of the code basically adds the footer nav to the array. Once you have successfully add the code, you may see this from your menu settings page.

footer navigation

The footer navigation should looks good by default. However, if you’d like to customize it even further, you may target it using .menu-footer class. Also, don’t forget to make use of great tool like Firebug to help you easily inspect any of element of your site.

Comments

  1. Manoj Jain says

    Hi friend,
    I am a new user of your blog, read post really amazing and informative which is helpful for every HTML users. Thanks for shard this post. I knew only few knowledge, need to go to your Genesis Theme Settings and enable the Primary or Secondary Menu depending on which you want to display in your footer area.

    • Editor says

      Hi,

      That’s the other way. You may unhook either primary or secondary navigation and hook it back to any position. The reason why I created a new navigation for the menu was because I’d like to limit the depth of the navigation to 1 so that it won’t show up. Secondly, some people might use both primary and secondary navigation, so it’s good to create a new one for the footer.

Leave a Reply

Your email address will not be published. Required fields are marked *