0

I'm working in Wordpress 4.9.5 For any WP navigation menu I create, what would be the best approach for adding a custom class name directly on the <ul> element? I need it on this element and prefer not to do javascript injections to add the class name to it.

0

I think this will solve your problem.

wp_nav_menu( array(
    'theme_location' => 'top-menu',
    'container' => false,
    'items_wrap' => '<ul class="nav your_custom_class">%3$s</ul>',
));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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