Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #959206

    I could use some help figuring out how to add a menu to the footer that is a duplicate of the main menu that is in the header. I want it to have all the same functionality as the top menu, i.e. drop downs.

    So far the only way that I have figured out to make it work is with this in my child theme functions.php file:

    // Add main menu to footer
    add_action ('avia_before_footer_columns', 'add_footer_main_menu', 0);
    function add_footer_main_menu() {
         get_template_part( 'includes/helper', 'main-menu' );
        }

    The problem is that this ends up bringing in the entire header. Using this method along with a bunch of CSS I have been able to achieve my goal, but with a lot of code bloat, repeated ID’s on the page, etc.

    There has to be a far more elegant way to do this, but it seems to be beyond my skill level.

    Thanks for your help. Love this theme!

    #960105

    Hey cjbuilt,

    Thank you for using Enfold.

    You can replace the get_template_part function with the wp_nav_menu function.

    
    // Add main menu to footer
    add_action ('avia_before_footer_columns', 'add_footer_main_menu', 0);
    function add_footer_main_menu() {
    	$output = "<div id='header_main_alternate' class='container_wrap'>";
    	$output .= "<div class='container'>";
    
    	$main_nav = "<nav class='main_menu' data-selectname='".__('Select a page','avia_framework')."' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">";
    	$avia_theme_location = 'avia';
    	$avia_menu_class = $avia_theme_location . '-menu';
    	$args = array(
    		'theme_location'	=> $avia_theme_location,
    		'menu_id' 			=> $avia_menu_class,
    		'menu_class'		=> 'menu av-main-nav',
    		'container_class'	=> $avia_menu_class.' av-main-nav-wrap',
    		'fallback_cb' 		=> 'avia_fallback_menu',
    		'echo' 				=>	false, 
    		'walker' 			=> new avia_responsive_mega_menu()
    	);
    
    	$wp_main_nav = wp_nav_menu($args);
    	$output .= $wp_main_nav;
    	$output .= "</nav></div></div>";
    	echo $output;
    }
    

    Best regards,
    Ismael

    #964998

    Thanks!

    #965002

    Hi,

    I’m glad you got this corrected. Id you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Duplicate main menu in the footer’ is closed to new replies.