0

I am trying to edit the default arguments in the wp_nav_menu function. Basically I need to add a custom class to the UL and a custom class to the LI.

I have tried to use

<?php
function my_wp_nav_menu_args( $args = '' )
{
    $args['menu_class'] = "test";
    return $args;
} // function

add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
?>

This added a test to the div outside.I tried to edit

'items_wrap' => '%3$s',

no luck.

  • 1
    Haven't you tried custom class mentioned in THIS built-in function? – Mayeenul Islam Jul 5 '13 at 20:15
  • which one specifically? – user31344 Jul 5 '13 at 20:26
  • $menu_class & 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>'? – Mayeenul Islam Jul 5 '13 at 20:32
  • yeah I tried that no dice, I am using a walker class and that seems to be doing it right. It's not explained very well, but apparantly you set up a walker class in the functions.php and then call that in your template. – user31344 Jul 5 '13 at 20:45

Your Answer

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

Browse other questions tagged or ask your own question.