• I would like to display multiple menus on the customizr header. Looking at the header.php file

    <?php do_action( '__before_header' ); ?>
    
    	   	<header class="<?php echo tc__f('tc_header_classes', 'tc-header clearfix row-fluid') ?>" role="banner">
    
    			<?php
    			//the '__header' hook is used by (ordered by priorities) : TC_header_main::$instance->tc_logo_title_display(), TC_header_main::$instance->tc_tagline_display(), TC_header_main::$instance->tc_navbar_display()
    				do_action( '__header' );
    			?>
    
    		</header>
    
    		<?php
    		 	//This hook is filtered with the slider : TC_slider::$instance->tc_slider_display()
    			do_action ( '__after_header' )
    		?>

    I have a main menu I want to display on the top and then I have another menu I want to display underneath the slider.

    can I add a php function

    <?php
    do_action(‘__display_extra_menu’)’
    ?>

    Where do I created this extra tag for the php function?

    And I want it to be an additional menu I have all ready created in wordpress through the menu creation page.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ChickenFur

    (@chickenfur)

    I can see in the file class-header-menu.php

    add_action ( '__navbar'   , array( $this , 'tc_menu_display' ), 30, 1);

    So how could I call

    do_action('__navbar')

    and set the menu that I want to be displayed.

    Thanks!

    Thread Starter ChickenFur

    (@chickenfur)

    Making a little progress, found lots of great code snippets here:

    https://www.themesandco.com/code-snippets/

    https://www.themesandco.com/snippet/add-widget-area-header/

    I will update if I find a solution.

    Thread Starter ChickenFur

    (@chickenfur)

    Thread Starter ChickenFur

    (@chickenfur)

    Final solution:

    Put this in my functions.php file and then through customizr added the secondary menu.

    <?php
    add_action( 'init', 'register_secondary_menu' ); // this registers your menu with WP
    function register_secondary_menu() {
        if ( function_exists( 'register_nav_menu' ) ) {
            register_nav_menu( 'secondary-menu', 'Secondary Menu' );
        }
    }
    
    // Select the add_action you need, depending on where you want to add the menu and disable the rest:
    //add_action('__before_header', 'display_secondary_menu');     // use this line to add above header
    add_action('__after_header', 'display_secondary_menu', 1000, 0);     // use this to add after header
    //add_action('__before_footer', 'display_secondary_menu');     // use this line to add above footer
    //add_action('wp_footer', 'display_secondary_menu', 1000, 0);     // use this to add before credits
    
    // display function for your menu:
    function display_secondary_menu() {
        echo ( has_nav_menu( 'secondary-menu' ) ? wp_nav_menu (
            array (
                'theme_location' => 'secondary-menu',
                'container_id'    => 'secondary-menu',
                'container_class'    => 'secondary-menu'
            )
        ).'<div class="clearall"></div>' : '' );
    }
    ?>

    Hey! That was good to watch ?? Well done!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Customizr – How To Display Multiple Menus on Same Page’ is closed to new replies.