Add active class to wp_nav_menu

You wont need that PHP code to style links to the current page in your nav. WordPress adds a class (current-menu-item) by default on links to the current page. But WordPress does not style the link for you. That would be part of the theme. You can add a rule to the theme’s CSS ( … Read more

WordPress customizing a walker menu class

If you want change only CSS classes, you can use filters nav_menu_submenu_css_class (for <ul> element, codex) and nav_menu_css_class (for <li>, codex). Example of usage: add_filter(‘nav_menu_css_class’ , ‘special_menu_item_class’ , 20 , 4); function special_menu_item_class($classes, $item, $args, $depth) { // add or replace classes $classes[] = ‘rd-nav-item’; if ($args->has_children) { $classes[] = ‘rd-navbar–has-dropdown’; } return $classes; }

Difference between “Walker_Nav_menu” and “walker”

Walker_Nav_menu extends walker and includes all the markup for a menu. walker by itself doesn’t have any markup, it just handles walking the tree, and needs to be extended to add markup. See the documentation: Extend the Walker class to use it, see examples below. Child classes do not need to implement all of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)