WordPress Menus "Manage Locations" tab is missing - wordpress

I have a fresh install of WordPress 4.0.1 running Twenty Fourteen theme with no plugins activated.
When I go to Appearance > Menus, I only see one tab "Edit Menus". "Manage Locations" tab that I used to have in earlier versions is missing.
When I create a new menu, it's not visible. However, if I try to create a new menu with the same name, I get an error message, "The menu name TESTMENU conflicts with another menu name. Please try another."

It turns out some themes does not have menu locations and you need to add theme manually through your theme's functions.php. Anyhow, here's what I did:
add_theme_support( 'menus' ); // <-- if you already see `menus` from your settings menu, you can ignore this line.
function register_menus() {
register_nav_menus(
array(
'primary-menu' => _( 'Primary Menu' ) // add locations here.
'your-preferred-menu-location-id' => _( 'Title of your menu location' )
)
);
}
add_action( 'init', 'register_menus' ); // <-- of course without this, the function above will not execute.
If the code above does not work for you, try enable/disable plugins that might be causing the issue.
Hope this helps.

Related

Amend description of menu location in customizer wordpress

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.

How to allow my theme to support multiple menus in wordpress

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'));?>

Place custom post type in add_submenu_page

I'm trying to place a custom post type under a menu page, I'm Using sandbox theme,
For example.
Main Menu
Sub Menu
Sub Menu(Custom Post)
This is the sample codes for place a submenu page. But I dont know how to implement it on custom post.
add_submenu_page(
'sandbox_theme_menu',
'Projects',
'Projects',
'administrator',
'sandbox_theme_social_examples',
create_function( null, 'sandbox_theme_display( "social_examples" );' )
);
I'm aware of using menu_position, but it is not what I want to do.
Any idea on how can I do this?
Add show_in_menu when register post type. Example('supports' added to show where place):
'supports' => array(
'title',
'thumbnail',
'editor'
),
'show_in_menu'=>'options-general.php'
Instead of options-general.php place your menu link. You can see it on mouseover. If link has get parameter like options-general.php?page=custom.php copy it all.

WP - how to create menus

Could you please explain me how do I properly create wordpress menus? I just want two menus on my website - with pages, and the other one with categories (by default).
Should I put html code for these menus in two separate files? Or rather put all id's in the array parameter of wp_nav_menu()? Tried the first one but the separate file nav-something.php doesn't seem to be loading ('theme_location' => 'nav-something').
If I want to display categories in the menu, should I simply use wp_list_categories()? Will user be able to change this in the future from admin interface?
Firstly You have to create the both menus under Appearance > Menu
Add below code where you want to show on the page. But you need to select the one menu as a primary menu in admin section. You can do this in Appearance > Menu > Primary Navigation
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
For your category menu add new menu in admin section under Appearance > Menu and give the name "Category Menu" and paste the below code where you want to show this menu. After that you need to add the categories in menu section. You can enable category listing in wordpress screen option(Right top section in admin panel.)
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu', 'menu' => 'Category Menu' ) ); ?>
Please note down I have given the same name in above code and in admin section "Category Menu". You can add more menus by adding above code but you just need to give the same name in code and in WordPress admin section.
If you Don't want to create category menu in admin section then you can add this code in you file.
<?php wp_list_categories(); ?>
You have both the options now its on you which one you want to use.

Add Submenu in sidebar on wordpress

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

Resources