php - I can't get both my header and footer menus to display properly in my wordpress theme -
i've been trying make header menu main hyperlinks , footer menu social media icons.
i've had header 1 while, it's since i've tried add menu in footer it's started displaying footer menu in header , footer. i've ensured of settings correct in wordpress end, still can't work.
in header.php have:
<nav class="header-nav"> <?php $args = array('theme_location' => 'header'); ?> <?php wp_nav_menu(); ?> </nav> in footer.php have:
<nav class="footer-nav"> <?php $args = array('theme_location' => 'footer'); ?> <?php wp_nav_menu(); ?> </nav> and in functions.php have:
register_nav_menus(array( 'header' => __( 'header menu'), 'footer' => __( 'footer menu'), ));
please change functions.php :
function register_my_menus() { register_nav_menus( array( 'primary' => esc_html__( 'primary menu', 'theme_wp' ), 'header' => __( 'menu header' ), 'footer' => __( 'menu footer' ) /*'an-extra-menu' => __( 'an menu' ) */ ) ); } add_action( 'init', 'register_my_menus' ); now template :
header.php
wp_nav_menu( array( 'theme_location' => 'header' ) );
footer.php
wp_nav_menu( array( 'theme_location' => 'footer' ) );
don´t forget asign menu options wp --> https://codex.wordpress.org/appearance_menus_subpanel
Comments
Post a Comment