I am a beginner to WordPress core and development course of. As I’ve a little bit information of WordPress capabilities. However I would like the assistance from you guys.
Really, i am creating my first theme and that i have already got the CSS for my menu. The menu has been registered in capabilities.php.
I’ve used the code posted beneath so as to add my class “mainnav-section”.
<?php
$args = [
'theme_location' => 'header-menu',
'container' => 'ul',
'container_class'=> '',
'menu_class' => 'mainnav-section'
];
wp_nav_menu($args);
?>
And it executed this.
<ul id="menu-header" class="mainnav-section">
<li id="menu-item-511" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-511">
<a href="http://#">Newest</a>
<ul class="sub-menu">
<li id="menu-item-512" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-512">
<a href="http://#">HardFork</a>
</li>
</ul>
</li>
<li id="menu-item-513" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-513">
<a href="http://#">Improvements</a>
</li>
</ul>
All I need to to do is so as to add my CSS class to main-menu objects, sub-menu and checklist objects. As a result of I’ve the CSS and JS accomplished to get the desired menu.