How can i add class within menu ul -> "li" tag?

Here we’ll add “col-eye” class within “li” tag

Output:

  1. <ul>
  2. <li class="col-eye"><a href="#">Lorem ipsam amit</a></li>
  3. <li class="col-eye"><a href="#">Lorem ipsam amit</a></li>
  4. <li class="col-eye"><a href="#">Lorem ipsam amit</a></li>
  5. <ul>

Input:

  1. <ul>
  2. <?php
  3. echo preg_replace( '#<li[^>]+>#', '<li class="col-eye">',
  4. wp_nav_menu(
  5. array(
  6. 'menu' => $nav_menu,
  7. 'container' => false,
  8. 'container_class' => false,
  9. 'menu_class' => false,
  10. 'items_wrap' => '%3$s',
  11. 'depth' => 1,
  12. 'echo' => false
  13. )
  14. )
  15. );
  16. ?>
  17. </ul>