Adding second menu above header
-
I have followed the instructions found here https://codex.ww.wp.xz.cn/Navigation_Menus to create a second menu in twenty twelve using the following code in the functions.php
function register_my_menus() { register_nav_menus( array( 'primary' => __( 'Primary Menu' ), 'top' => __( 'Top Menu' ) ) ); } add_action( 'init', 'register_my_menus' );However I can’t get it to display. I am placing WP nav_menu in the header.php above the masthead with this code.
<?php wp_nav_menu( array( 'theme_location' => 'top', 'menu_class' => 'nav-menu' ) ); ?>
I am running WP 4.53
Any help would be appreciated. Thanks
-
This is the standard format,try to replicate it
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu' ) ); ?>@earl_d: Do not edit the theme itself. First create a child theme for your changes.
@ashiquzzaman: Thank you contributing to the forums but please do not encourage people to edit theme files directly. At best, they will lose all of their changes when they update the theme. At worst, they could bring their site down. They should be recommended to create a child theme or use a custom CSS plugin for their changes, if appropriate.
@esmi Thanks for the reminder.
@weblizar_support Always use child themes for theme modification. Follow the link esmi posted.Thanks for the response guys. I am working with a child theme. Sorry did not mention that before. Also using the custom ccs edit that comes with jetpack to edit css.
I got the menu working but I cannot get a horizontal secondary menu without screwing up the primary menu so all I have ended up with is this
https://drive.google.com/open?id=0BwL9twPXsX5VWHZaZ0RUMGpHYU0
When I want some thing like this
https://drive.google.com/open?id=0BwL9twPXsX5VWkZzUTBJZUhSTW8
Or this
https://drive.google.com/open?id=0BwL9twPXsX5VVWxDc2llRDFBNkk
Any suggestions for the css styling to get a horizontal secondary menu. I have tried to copy the css from the style sheet and add to styles for the secondary menu but that has not worked as I said. So any help would be appreciated.
Thanks again
I’d suggest you to use social sharing/icon plugins
@ashiquzzman I do t think you understand what I am trying to do. Not trying to do social share just create a secondary navigation menu.
@earl_d were you ever able to figure this out? I’ve been trying and trying as well and can’t get anything to work!
No never did ended up abandoning the effort
The topic ‘Adding second menu above header’ is closed to new replies.
