Change class-name on “current_ancestor” in wp_nav_menu

I believe the current-ancestor etc. classes are not added by the walker itself, but rather by wp_nav_menu which is calling _wp_menu_item_classes_by_context. Thus, your best bet is probably to add a filter to nav_menu_css_class and remove/replace current-* classes as needed. In its most basic form, something like: function my_navigation_class($classes, $item){ foreach ($classes as $idx => $class) … Read more

wp_nav_menu $theme_location parameter ignored

The documentation is wrong. Check the source. There are two telling comments. First there is: // Get the nav menu based on the theme_location And after which there is another comment that reads: // get the first menu that has items if we still can’t find a menu Following that last comment the code runs … Read more

Create menu without admin panel

Try this link may helpful http://codex.wordpress.org/Function_Reference/wp_create_nav_menu // Check if the menu exists $menu_exists = wp_get_nav_menu_object( $menu_name ); // If it doesn’t exist, let’s create it. if( !$menu_exists){ $menu_id = wp_create_nav_menu($menu_name); // Set up default menu items wp_update_nav_menu_item($menu_id, 0, array( ‘menu-item-title’ => __(‘Home’), ‘menu-item-classes’ => ‘home’, ‘menu-item-url’ => home_url( “https://wordpress.stackexchange.com/” ), ‘menu-item-status’ => ‘publish’)); wp_update_nav_menu_item($menu_id, 0, … Read more

Admin: sub menu doesnt display under apperance when activate my themes

Most of those are controlled by your theme support. The functionality does not come for “free” with WordPress, you need to implement the actual code. Once you have put together the code for your theme to support one of the features you can enable it with add_theme_support. for example, in functions.php: add_action( ‘after_setup_theme’, function () … Read more

How to add html attributes to the “ul” html tag with “wp_nav_menu” function?

wp_nav_menu has all the documentation written there. You just need to put “ul” in the parameter “container”. So your modified function call will be, wp_nav_menu( array( ‘theme_location’ => ‘main-menu’, ‘container => ‘ul’, ‘container_id’ => ”, // put id of ul if needed ‘menu_class’ => ” // as needed ) ); For custom attributes you need … Read more

WPML Plugin Not displaying multilingual Menus

I ended up having to manually detect the language, here’s how I solved it: <?php if (ICL_LANGUAGE_CODE == ‘fr’) { // display the menu en francais wp_nav_menu( array( ‘menu’ => ‘Navigation principale’, ‘theme_location’ => ‘primary’, ‘container_class’ => ‘menu-header’, ‘menu_id’ => ‘menu-primary-navigation’ ) ); } else { // show them the menu in English wp_nav_menu( array( … Read more

Redirect to another page using contact form 7? [closed]

Redirect to another page using contact form 7? [closed]