Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

good evening,

Im been having some kind of problem with a specific, and as far as I can see, simple WP project, specifically with how to use the wp_nav_menu function, normally, when I try to create a WP Menu I use something like this:

<?php wp_nav_menu( array('menu' => 'Main', 'container' => 'nav' )); ?>

And always use the same function on my functions.php document which is:

add_theme_support('nav-menus'); if ( function_exists('register_nav_menus')) {register_nav_menus( array('main' => 'Main Nav') );}

The thing is, when I try to use that code to convert my HTML menu into a WP menu nothing works, then, reading something I tried with this:

<?php wp_nav_menu( array('menu' => 'Main', 'container' => '', 'container_class' => '', 'menu_class' => '', 'menu_id' => '' )); ?>

But that missed a few things like icons on each button and the color which was gone as well, the menu in HTML is this one:

http://pastebin.com/n17C9Arv

So my question is basically, what am I missing?, why I'm not being able to reproduce the converted wp menu exactly like the html menu?

Driving me crazy....

Thanks guys!

Arturo

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Greetings and thanks for posting on the forums.

If you want to register a single nav menu then use the function register_nav_menu instead of register_nav_menus as following to register it.

if ( function_exists('register_nav_menus')) {
    register_nav_menu( 'main', 'Main Nav' );
}

Note: The function register_nav_menu automatically registers custom menu support for the theme therefore you do not need to call add_theme_support( 'menus' );

To display navigation menu use the following code.

<!-- Navbar starts -->
 <div class="navi pull-right">
    <?php wp_nav_menu( array('theme_location' => 'main', 'container' => '<div>', 'container_class' => 'mattblackmenu', 'container_id' => 'ddtopmenubar' )); ?>
</div>

<div class="navis"></div>
 <!-- Navbar ends -->

Add the tag in the Navigation Label menu field to be displayed inside the anchor tag and bgreen class CSS Classes menu field as displayed in the attached screenshot.

If you are not getting "CSS Classes" menu field option then check the checkbox in the Screen Options as shown in the attached screenshot.

enter image description here

In your CSS code replace ".bgreen a" in place of ".bgreen" and .sub-menu in place of #ddsubmenu2 & .ddsubmenustyle if you have used any of these selectors in your CSS code.

You will find more information about parameters of wp_nav_menu() function on the following page.

http://codex.wordpress.org/Function_Reference/wp_nav_menu

Best Regards, Vinod Dalvi

share|improve this answer
    
Hi Vinod Dalvi thanks so much, however is not working completely properly, something is not working at all, I have 2 images of how it should look like, but using what you gave me I ended with a list menu and not the squares I should be using, but maybe I'm doing something wrong, do you know how to post pictures in comments? !Image. –  Arturo Jun 8 at 14:40
    
Here's an image of how it is looking and how it should look, not sure what i am doing wrong: !Example Image is Here –  Arturo Jun 8 at 14:58
    
Have you made changes in the CSS code as i have instructed? –  Vinod Dalvi Jun 8 at 16:35
1  
Could you please share me your site link so that i can troubleshoot it? –  Vinod Dalvi Jun 8 at 16:36
    
Sure, the thing is, it has a maintenance mode on it, so I'd rather go and send that info privately, is there a way to do that? –  Arturo Jun 8 at 22:28
show 7 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.