Submenu not showing wordpress - wordpress

My submenu is not displaying. I've tried all the possible wp_nav_menu php, but I just can't get my submenu to show up.
<?php wp_nav_menu( array('menu' => 'navigation' )); ?>

And you have checked your CSS? Most of the time it's just a display:none-problem.

Related

Menu navigation wordpress

I´m working on a wordpress site with 2 diffrent sections (landingpage that link to private or corporate). The sections have diffrent menu navigation buttons. Do I have to install 2 separate wp-installations or is there any better way to solve the navigation issue?
You don't have to install wordpress twice. To present some menu you can use
wp_nav_menu() function (see: http://codex.wordpress.org/Function_Reference/wp_nav_menu).
So in different files of your theme you can use:
<?php wp_nav_menu( array('menu' => 'menu1' )); ?>
and
<?php wp_nav_menu( array('menu' => 'menu2' )); ?>
Than, you have to create 2 menu1 and menu2 in the Appearance → Menus panel.

Attach a specific menu to a specific page

In my Wordpress website:
I have two pages, one is in Deutsch and one is in English.
I have two menus, same deal.
I would like to display the english menu when browsing the page in English and display the deutsch menu when browsing the page in Deutsch.
I cannot use any multilingual pluging unfortunately.
Is there any way to achieve this with a basic wordpress installation?
Why can't you use a multi-language plugin?
Assuming you're right about the idea of not being able to use such a plugin, two solutions come to mind:
Use custom fields and conditional logic to display one menu or another
Use page templates to display different menus
You can override the layout of a page by creating a file called page-{slug}.php or page-{id}.php, in which {slug} and {id} should be substituted for the slug or id of the page you wish to make a template for. In this page template you could copy the original layout, but alter the wp_nav_menu command to select a different menu.
There are a few other ways to do it, but those two seem like sensible options to me.
Try this one:
Put this code in header.php while calling navigation menu:
<?php if (is_front_page()) { ?>
<div id='frontPageBanner'>
<?php wp_nav_menu( array( 'container_class' => 'menu-header-1', 'theme_location' => 'primary' ) ); ?>
</div>
<?php } elseif (is_archive()) { ?>
<div id='archiveBanner'>
<?php wp_nav_menu( array( 'container_class' => 'menu-header-2', 'theme_location' => 'primary' ) ); ?>
</div>
<?php } elseif ( is_page($pageID)) { ?>
<div id='pageIdBanner'>
<?php wp_nav_menu( array( 'container_class' => 'menu-header-1', 'theme_location' => 'primary' ) ); ?>
</div>
<?php } ?>
Thanks.

Wordpress - current-menu-item class missing

In a custom template file I'm inserting one of my custom menus:
<?php wp_nav_menu( array('menu' => 'Internal' ));?>
However the menu fails to generate the class current-menu-item for the current li item.
I am inserting a menu in the same way for menus in other pages without any issues.
What might cause Wordpress to fail output of the current-menu-item?
Cheers
Teodor
Try to use wp_reset_query() function.
<?php
wp_reset_query();
wp_nav_menu( array('menu' => 'Internal' ));
?>
Try to use the menu function
<?php wp_nav_menu( array('theme_location' => 'primary','menu' => 'Internal' ));?>
you will get the .current-menu-item in the li and you can make the effect accordingly

wp menu displays in the wrong location after adding a new menu

I have done this million times before and I have no clue what is going on now. I've had one navigation menu, client asked me to add another one and the whole thing collapsed. After I added second navigation, added some pages to it and assigned it to the right location, the first menu appears in the location of the second one, and in the location of the first again it is the first menu.
Here is my register nav code in functions.php:
register_nav_menus( array(
'primary' => __( 'Top navigacija', 'wpfme' ),
'above' => __( 'Above header', 'wpfme' ),
) );
Here is the placement of both in the header.php file:
<div class="left" id="kkk_top">
<p><?php bloginfo('name'); ?> <?php wp_nav_menu( array('menu' => 'Above header' )); ?>
</p>
</div><!-- #kkk-top -->
<div id="main_navigation">
<?php wp_nav_menu( array('menu' => 'Top navigacija' )); ?>
</div><!-- #main_navigation -->
I should also add that menu that now appears in the Above header location is wrapped in the div with the dynamic id it had when there was no second navigation, and menu that now appears in the Top navigacija location is wrapped in a div with a new dynamic id.
I just deleted the second menu and created it again, placed it in the new theme location and now it s all cool... when in doubt always reboot :)

Why aren't my drupal 7 submenu's showing?

I can't seem to get my sub-menus to display.
I've gone to: Home » Administration » Structure » Menus
Then, I've edited the parent menu and checked the tickbox that says "Show as expanded" - but still nothing.
The code on my page.tpl.php page for the navigation I'm referring to, is as follows:
<?php
if ($page['navigation'] || $main_menu):
?>
<?php
print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => 'nav',
'class' => array('links', 'clearfix'),
),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
));
?>
<?php
print render($page['navigation']);
?>
<?php
endif;
?>
What am I doing wrong?
Any help would be GREATLY appreciated.
Make sure that the parent menu "Show as expanded" attribute is checked.
Go to admin/structure/menu/item/MENU_ITEM_ID/edit, and check "Show as expanded"
Instead of using the $main_menu variable, you can use the main-menu block, which is generated with the menu.
If you put the "Main menu" block into the "Navigation" region at admin/structure/block, print render($page['navigation']) in the page.tpl.php will print out the complete menu, including its sub menu items (children).
Just make sure you tick the "Show as expanded" option in the parent menu link.
Lastly, remove the "print theme" stuff, otherwise you end up with double menu's.
the page.tpl.php will look something like this:
<?php if ($page['navigation']): ?>
<div id="navigation"><div class="section clearfix">
<?php print render($page['navigation']); ?>
</div></div><!-- /.section, /#navigation -->
<?php endif; ?>
The stark theme out-of-the-box doesn't show submenuus in it's main menu either (2011/04).
If you however go to admin/structure/blocks, and drag the menu block to the header region in the stark theme, it has submenus.
You'll also have two menus then, the original one without submenus and the new one with submenus. You can disable the original one in admin/appearance/stark/settings.
$2c,
*-pike

Resources