adding a numbers to a item from navigation menu

You can target the location like this: function wpa_filter_nav_menu_objects( $items, $args ){ if( $args->theme_location === ‘primary’ ){ foreach( $items as $item ){ if( strtolower( $item->title ) === ‘sample page’ ){ $item->title = $item->title . ‘(10)’; } } } return $items; } add_filter( ‘wp_nav_menu_objects’, ‘wpa_filter_nav_menu_objects’, 10, 2 ); You can also try $args->menu_id if you use … Read more

TwentyTwelve child theme: Incorrect footer menu

I expect that the theme_location is “footer” not “Footer”. It is case sensitive. I just checked. If you use a bad theme_location wp_nav_menu will fallback to what looks like a page menu when I test it. Edit: Due to additional information in the question, the theme_location is footer-menu and not footer. If you look at … Read more

Determine if a navigation item has children

You can filter wp_nav_menu_objects and add the classes in one rush. You don’t even need a custom walker for that. add_filter( ‘wp_nav_menu_objects’, ‘add_has_children_to_nav_items’ ); function add_has_children_to_nav_items( $items ) { $parents = wp_list_pluck( $items, ‘menu_item_parent’); foreach ( $items as $item ) in_array( $item->ID, $parents ) && $item->classes[] = ‘has-children’; return $items; } The class has-children will … Read more

How to use my custom menus as seperate pages?

You have to create a corresponding “Page” for the items in your menu, unless those items are things that would have an automatically generated page, like a category archive or author archive. You would then select those items when you create the menu.

Menu – custom structure

Problem is fixed. Here is the solution: functions.php register_nav_menu( ‘primary’, __( ‘Primary Menu’) ); class Menu_With_Description extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $depth ) ? str_repeat( “\t”, $depth ) : ”; $class_names = $value=””; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( … Read more

Display same menu for parent and all its children

Yes, create 3 custom menus and use a conditional. Example you have 3 custom menus named, Products, Services,Training. Open the section of the page you want to insert code in the header.php or where ever you need it. file and use: if (is_page( array( 42, ‘Products’ ) )) { wp_nav_menu(‘menu’ => ‘Products’); }elseif(is_page( array( 2, … Read more

menu items outside of blog

Maybe you are referring to something like this: <?php define( ‘WP_USE_THEMES’, false ); require_once( ‘/absolute/path/to/wp-blog-header.php’ ); wp_nav_menu( $args ); but the current menu item highlighting will not work as expected.

Can’t style custom menu

I think you are not targeting the element correctly. Try this: #mainmenu { display: block; } #mainmenu ul.nav-primary { list-style-type: none !important; background-color: rgba(0,0,0,0.25) !important; padding: 5px !important; border-radius: 8px !important; -moz-border-radius: 8px !important; -webkit-border-radius: 8px !important; } #mainmenu ul.nav-primary li { display: inline-block !important; background-color: rgba(0,0,0,0.25) !important; margin-right: 5px !important; height: 32px !important; padding-top: … Read more

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