As in the WP menu add a class?

Hello. I have here is the navigation menu of the landing page!
59da2845ad322460982463.jpegThus it appears in the html template
<div class="collapse navbar-collapse navbar-right" id="bs-example-navbar-collapse-1">

 <ul class="nav navbar-nav">
 the <li><a class="page-scroll" href="#main">Home</a></li>
 the <li><a class="page-scroll" href="#classes">Classes</a></li>
 the <li><a class="page-scroll" href="#features">Features</a></li>
 the <li><a class="page-scroll" href="#review">Reviews</a></li>
 the <li><a class="page-scroll" href="#pricing">pricing</a></li>
 the <li><a class="page-scroll" href="#contact">contact</a></li>
</ul>
 </div>


Menus in WP I brought

$args = [
 'theme_location' => 'menu-1',
 'menu_class' => 'nav navbar-nav',
 'container_class' => 'collapse navbar-collapse navbar-right',
 'container_id' => 'bs-example-navbar-collapse-1',
 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
];
wp_nav_menu($args);
 ?>


But I don't understand how to add the class="page-scroll"

Tell me what to do.
June 14th 19 at 18:26
1 answer
June 14th 19 at 18:28
Try it in the output argument menu_class just add the name of your class. Here it is:

$args = [
 'theme_location' => 'menu-1',
 'menu_class' => 'nav navbar-nav page-scroll',
 'container_class' => 'collapse navbar-collapse navbar-right',
 'container_id' => 'bs-example-navbar-collapse-1',
 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
];
wp_nav_menu($args);
 ?>


If you need to div'have, inside of which lies the list, add class, add it to the "container_class" like this:

$args = [
 'theme_location' => 'menu-1',
 'menu_class' => 'nav navbar-nav',
 'container_class' => 'collapse navbar-collapse navbar-right page-scroll',
 'container_id' => 'bs-example-navbar-collapse-1',
 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
];
wp_nav_menu($args);
 ?>
Only carefully code see: in that piece you gave, there is the end code for PHP and start it there.
Don't lose - hilda.Conroy commented on June 14th 19 at 18:31

Find more questions by tags PHP