How to add the first class to the menu of the first six li using wp_nav_menu html:

<?php wp_nav_menu(array('theme_location'=>'menuOne', 'container'=>'false', 'menu_class'=>'cf')); ?> 

    1 answer 1

     <?php echo str_replace('class="menu-item', 'class="menu-item CLASSNAME', wp_nav_menu( array( 'echo' => 0, ) ) ); ?> 
    • one
      So, if adding a certain class is necessary for giving styles, then you can use css pseudo-classes. For example li: nth-child (1), li: nth-child (2) .... - Vedenin