• I’m using the wp_nav_menu_items filter hook to add a subnav to the main navigation for this site: https://www.newspebbles.com
    It uses a child theme for 2013

    function new_nav_menu_items($items) {
    	global $wpdb; 
    
    	$localities_links = '';
    
    	$query = //etc
    	$localities = //etc
    
    	if( $localities ) {	
    
    	    foreach( $localities AS $locality ) {
    
    		$localities_links .= '<li id="menu-item" class="menu-item menu-item-type-post_type menu-item-object-page"><a href="https://www.newspebbles.com/' . $locality->locality_slug . '/">' . $locality->locality_name . '</a></li>';	
    
    	    }
    
    	    $items = str_replace('<a>Localities</a></li>', '<a>Localities</a><ul class="sub-menu">'.$localities_links.'</ul></li>', $items);
    	}
    
        return $items;
    }
    add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );

    The ‘Localities’ link ( and all the other links ) was created via Appearance > Menus.
    This works properly on laptops.
    But on mobile devices the links do not work.
    On iOS, the ‘Localities’ link does not work.
    On Android, the ‘Localities’ link shows the subnav, but the subnav links do not work.

    What is the recommended solution re main nav on mobile?
    Will I have to use wp_nav_menu to create the whole nav menu via code?
    And / or a custom walker?

  • The topic ‘wp_nav_menu_items – mobile problem’ is closed to new replies.