我创建了一个分类菜单,但当它显示在头版时,它只显示文本,没有链接。这就是我的代码:
$menuname1 = $lblg_themename1 . \'categorie Menu\';
$bpmenulocation1 = \'secondary\';
// Does the menu exist already?
$menu_exists1 = wp_get_nav_menu_object( $menuname1 );
// If it doesn\'t exist, let\'s create it.
if( !$menu_exists1){
$menu_id1 = wp_create_nav_menu($menuname1);
// Set up default BuddyPress links and add them to the menu.
wp_update_nav_menu_item($menu_id1, 0, array(
\'menu-item-title\' => __(\'Accueil\'),
\'menu-item-object\' => \'page\',
\'menu-item-object-id\' => get_page_by_path(\'accueil\')->ID,
\'menu-item-type\' => \'post_type\',
\'menu-item-status\' => \'publish\'));
wp_update_nav_menu_item($menu_id1, 0, array(
\'menu-item-title\' => __(\'High Tech\'),
\'menu-item-object\' => \'category\',
\'menu-item-type\' => \'taxonomy\',
\'menu-item-status\' => \'publish\'));
wp_update_nav_menu_item($menu_id1, 0, array(
\'menu-item-title\' => __(\'Geek\'),
\'menu-item-object\' => \'category\',
\'menu-item-type\' => \'taxonomy\',
\'menu-item-status\' => \'publish\'));
wp_update_nav_menu_item($menu_id1, 0, array(
\'menu-item-title\' => __(\'Web\'),
\'menu-item-object\' => \'category\',
\'menu-item-type\' => \'taxonomy\',
\'menu-item-status\' => \'publish\'));
wp_update_nav_menu_item($menu_id1, 0, array(
\'menu-item-title\' => __(\'Science\'),
\'menu-item-object\' => \'category\',
\'menu-item-type\' => \'taxonomy\',
\'menu-item-status\' => \'publish\'));
// Grab the theme locations and assign our newly-created menu
// to the BuddyPress menu location.
if( !has_nav_menu( $bpmenulocation1 ) ){
$locations1 = get_theme_mod(\'nav_menu_locations\');
$locations1[$bpmenulocation1] = $menu_id1;
set_theme_mod( \'nav_menu_locations\', $locations1 );
}
}
enter code here