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.

I'm having trouble with wp_nav_menu function. I want the menu to have no div wrapper; have the class sf-menu right for ul element of the menu and li elements not have any classes. I've tried many combinations, but hasn't gave me the proper result.

my current wp_nav_menu function:

    <div class="col-md-11">
        <?php wp_nav_menu(array(
            'theme_location' => 'primary-menu',
            'container'       => false,
            'menu_class'      => 'sf-menu right',

        )); ?>
    </div>

How can I achieve my goal result?

EDIT

my result after trying :

<div class="col-md-11">
    <?php wp_nav_menu(array(
            'theme_location' => 'primary-menu',
            'container'       => '',
            'items_wrap' => '<ul class="sf-menu right"><li></li>%3$s</ul>' )
    ); ?>
</div>

RESULT :

<div class="col-md-11">
    <div class="menu">
        <ul>
            <li class="page_item page-item-20"><a href="http://localhost/oranet/website-optimization/">بهینه سازی وبسایت</a>
            </li>
            <li class="page_item page-item-26"><a href="http://localhost/oranet/contact-oranet/">تماس با ما</a>
            </li>
            <li class="page_item page-item-18 page_item_has_children"><a href="http://localhost/oranet/web-design/">طراحی سایت</a>
                <ul class="children">
                    <li class="page_item page-item-28"><a href="http://localhost/oranet/web-design/portfolio/">نمونه کارها</a>
                    </li>
                </ul>
            </li>
            <li class="page_item page-item-22"><a href="http://localhost/oranet/e-commerce/">فروشگاه اینترنتی</a>
            </li>
            <li class="page_item page-item-24"><a href="http://localhost/oranet/articles/">مقالات</a>
            </li>
        </ul>
    </div>
</div>
share|improve this question
    
What is the "proper result"? –  s_ha_dum Apr 30 at 14:23
    
@s_ha_dum It's the explanation of the menu that I want, I've told in the question. –  1linecode Apr 30 at 14:25
    
Whatever you think you've explained in the question, it isn't clear. –  s_ha_dum Apr 30 at 14:30

1 Answer 1

You can try this following code

<div class="col-md-11">
    <?php wp_nav_menu(array(
        'theme_location' => 'primary-menu',
        'container'       => '',
        'items_wrap' => '<ul class="sf-menu right"><li></li>%3$s</ul>' )
    )); ?>
</div>
share|improve this answer
    
I tried it, but no luck. I enter my output in Q. see it for more info... –  1linecode Apr 30 at 14:08
    
try again I've posted it. –  1linecode Apr 30 at 14:13
    
Did you assigned the menu on administration ? –  Maidul Apr 30 at 14:20
    
of course I did –  1linecode Apr 30 at 14:22
    
The code i send you it remove the container div and add class to the <ul>.I tested it on Twenty Thirteen theme –  Maidul Apr 30 at 14:26

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.