I have made a main page on wordpress with a specific menu for that page and when I redirected to another page I need a totally different menu in the header but appears the same menu of the main page,I tried with
register_nav_menu( 'primary', __( 'Default', 'patti' ) );
register_nav_menu( 'navegacion-cabecera', __( 'Menu Cabecera', 'patti' ) );
but don´t works.
Thank you.
Related
Amend description of menu locations in customizer? I just want to add note that I have limited menu depth. Not really sure how to do it.
I refer to this description under 'Menu Locations'
Your theme supports 2 menus. Select which menu appears in each
location. You can also place menus in widget areas with the “Custom
Menu” widget.
or to add description for Menu panel.
I tried like this
$wp_customize->get_setting( 'nav_menus', array(
'description' => esc_html__( 'new description', 'theme_name' ),
) );
OK, here is it not sure if its OK to post link to it. Answer by Weston Ruter, thanks!
add_action( 'customize_register', function( $wp_customize ) {
$section = $wp_customize->get_section( 'menu_locations' );
$section->description .= "<p>Custom HTML added.</p>";
}, 12 );
for more informations check out the link above.
I have converted my one page html website to wordpress theme. Index.html page is converted to header.php, index.php and footer.php .
Now I want to make a dynamic menu. I have registered my menu in WordPress and it I showing in the admin panel. When I create a new menu now the page is showing to add my menu there. How can I create that page?
You may need to register the menu via functions.php.
If you dont have, create a file inside your theme as functions.php and paste the following code to register the menu.
register_nav_menus( array('my_nav' => __( 'Primary Navigation', 'dz theme' ),
'secondary' => __('Secondary Navigation', 'dz theme')
));
And you can call your primary menu as :
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'my_nav' ) ); ?>
I am developing a site in Wordpress. I am using a theme named Moesia. While customizing the the theme according to my website needs, i found that the theme only supports one menu which is the main menu at the Top Right.
I want to add another menu which will only be visible inside a page. I have tried to add custom menu to a page, the issue that when I click on a menu item the whole page refreshes and the menu goes away. I want the menu to stay on that page and a click on the menu item should display the content adjacent to the menu.
I am absolutely new to this technology.
How can I achieve this?
Add the following to your functions.php file. The 2 menus are the “Primary”, and “Secondary” menus.
//Register Navigations
add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
'secondary-menu' => __( 'Secondary Menu' )
)
);
}
To add them to your site you need to add the following to your WordPress template files (most likely your header.php and footer.php files).
<?php wp_nav_menu (array('theme_location' => 'primary-menu','menu_class' => 'nav'));?>
<?php wp_nav_menu (array('theme_location' => 'secondary-menu','menu_class' => 'nav'));?>
How do I get the nav menu list through the menu name in Wordpress?
I'm using the following code but it's showing all pages and is not using the custom nav menu name
<?php wp_page_menu('sort_column=ID&sort_order=desc;');?>
Thanks for helping.
you should register your menu in your functions.php file and add it to init.
register_nav_menu( 'header', __( 'Header Menu', 'twentyeleven' ) );
And you can display anywhere this menu as below :
wp_nav_menu( array( 'theme_location' => 'header','container' => false,'menu_id' => 'nav' ) );
First of all,
you should really assign the menu in your functions.php file and add it to init. Something like this should do:
function register_my_menus()
{
register_nav_menus(array( 'main-menu' => __( 'Main Menu' ) ) );
}
add_action( 'init', 'register_my_menus' );
Then in you wordpress theme you simple call it like so:
wp_nav_menu(array('menu_id' => '',
'menu_class' => '',
'container' => '',
'theme_location' => 'main-menu'
));
You can fill in classes, or menu ids you need, important thing is the "main-menu" clausole displaying menu you created.
Now you just need to go to your wordpress admin > appearence > menus, select your menu from the top tab list, and assing it to theme location, on right-hand side. Where it says "Theme Locations", just select "Main Menu" from the dropdown list, and hit save.
Hope this helps.
i would like to show the submenu of my page in a custom page template on the left side in a Sidebar-area. Does any know the code for showing the submenu.
I'm using Wordpress 3.4.1.
Register Menus
Firstly, in your theme's functions.php, you need to write a function to register the names of your menus.
function register_my_menus() {
register_nav_menus(
array( 'sidebar-menu' => __( 'Sidebar Menu' ) )
);
}
add_action( 'init', 'register_my_menus' );
Display Menus on Theme
Once you've done that, your theme will be almost ready. The last preparation step is to tell the theme where you want the menus to show up.
<?php wp_nav_menu( array( 'theme_location' => 'sidebar-menu' ) ); ?>
That's all the background work. To finish, you would simply visit the Appearance -> Menus panel in your site admin.
Please read the wordpress codex site.. it has plenty of information on how to do this..
http://codex.wordpress.org/Navigation_Menus