Declaring in variables [closed]

You need to call global $variable; before you can use the variable. Try the code below instead for that line. // setup your global scope here global $icon_var; // set the new value in global scope $icon_var = get_post_meta($menu_item->ID, ‘_menu_item_custom’, true); // then use the variable $menu_list .= “\t\t\t\t\t<li><a href=\”$url\”>$icon_var<span>$title</span></a></li>\n”; DYNAMIC GLOBAL VARIABLE NAME If … Read more

Where to implement custom walker class?

The walker class is an abstract class designed to help traverse and display elements which have a hierarchical (or tree like) structure. It doesn’t actually ‘do’ (in the sense of generating HTML) anything. in your template files, we will use the wp_nav_menu() function twice, pointing to the same theme location (I shall call it ‘primary’). … Read more

how to disable default menu classes

i got a answer from another thread.. which is bellow add_filter(‘nav_menu_css_class’, ‘discard_menu_classes’, 10, 2); function discard_menu_classes($classes, $item) { $classes = array_filter( $classes, create_function( ‘$class’, ‘return in_array( $class, array( “current-menu-item”, “current-menu-parent” ) );’ ) ); return array_merge( $classes, (array)get_post_meta( $item->ID, ‘_menu_item_classes’, true ) ); } ref : http://wordpress.stackexchange.com/questions/30417/removing-all-classes-from-nav-menu-except-current-menu-item-and-current-menu-par

Getting the current menu item id from specific menu

This was the solution to my problem: Then what I would do is to store the clicked anchor in a cookie using javascript and read it while loading the new page. $_SERVER[‘HTTP_REFERER’] won’t be reliable here. – Luis Sanz Jul 19 at 12:33

how to add custom wp_nav_menu class css selector to ul and a tags?

The following example adds a unique CSS class to a single, specific nav menu item. function my_special_nav_class( $classes, $item ) { if ( is_single() && $item->title == ‘Blog’ ) { $classes[] = ‘special-class’; } return $classes; } add_filter( ‘nav_menu_css_class’, ‘my_special_nav_class’, 10, 2 );