0

I have created a category menu but when it displays in front page it shows just text without link. thats my code:

$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
1
  • @sakibmoon do you have an idea about this. thank you firstly Jul 29 '15 at 12:16
0

I couldn't find any other way to resolve this problem. i tried a lot of thing to add link to the category menu but without any success.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.