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.

Thesis appears to automatically add the sub-menus (sub-menu ul) to menu parents if childs exists. I have a specific need to remove this html from a particular menu.

The menu name is: second_level

Not sure if there a hook to do this.

I'm trying to remove these from the menu name above.

<ul class="sub-menu">...</ul>

I'm not trying to remove the class but the UL's.

share|improve this question
1  
Thesis is a commercial Theme. Have you tried DIY Themes support? –  Chip Bennett Feb 20 '13 at 2:25

1 Answer 1

up vote 1 down vote accepted

You can change nav menu args via the wp_nav_menu_args filter.

So let's say you have a theme that does something like this...

<?php
wp_nav_menu(array(
    'theme_location'   => 'second_level',
    'depth'            => 2, // how many levels to show
    // prolly some other stuff here
));

You can hook into wp_nav_menu_args, check for the theme location, and set depth to be 1 and remove submenus.

<?php
add_filter('wp_nav_menu_args', 'wpse87565_change_depth');
function wpse87565_change_depth($args)
{
    if (!empty($args['theme_location']) && 'second_level' === $args['theme_location']) {
        $args['depth'] = 1;
    }

    return $args;
}
share|improve this answer

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.