WordPress wp_nav_menu Code
wp_nav_menu(array(‘theme_location’ =>’primary’,’menu_class’ => ‘navigation’))
“functions.php” is stored with each Theme in the Theme’s subdirectory in wp-content/themes.
Each theme has its own functions file, but only the “functions.php” in the active Theme affects how your site publicly displays. If your theme already has a functions file, you can add code to it. If not, you can create a plain-text file named “functions.php” to add to your theme’s directory.
WordPress active page Code
add_filter(‘nav_menu_css_class’, ‘add_active_class’, 10, 2 );
function add_active_class($classes, $item) {
if( $item->menu_item_parent == 0 && in_array(‘current-menu-item’, $classes) ) {
$classes[] = “active”;
}
return $classes;
}