How to create a new menu using Child theme
-
Hi Everyone,
I created a 3rd menu for my a theme I purchased (MayaShop Theme) and I’m running into some issues. I am working with a child theme so in the Functions.php file of the child theme I addedadd_action( 'init', 'register_my_menu' ); function register_my_menu() { register_nav_menu( 'header-middle-menu', __( 'Header Middle Menu' ) ); }
Which basically got my menu to appear in the backend menu area. I then needed to call out the menu in the template file (please excuse my terminology I’m not too sharp when it comes to PHP). So I needed to add the follow( I believe please feel free to correct me if I’m wrong ?? ):
<?php if ( function_exists('has_nav_menu') && has_nav_menu('nav') && has_nav_menu('header-middle-menu') ) { wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'secondary-nav', 'menu_class' => 'nav fl', 'theme_location' => 'header-middle-menu' ) ); }?>
Now I normally would add this to the Header.php file however since I am working with a Child theme I’m not sure the best way to go about doing this. Is there a function I can add to the “Function.php” file to somehow insert that line of code into the parent header.php?
Or is the only way to copy the parent’s header.php file into the child theme and make the altercations there.
Thanks in advance for your time and support!
- The topic ‘How to create a new menu using Child theme’ is closed to new replies.