Hide a tabs With a Category

This topic contains 3 replies, has 3 voices, and was last updated by  Stiofan O’Connor 8 years ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #373158

    Diego Betancourt
    Free User
    Post count: 6

    Hi there.

    I´m just tring to hide or remove some tabs when a category called suggest is used. I have followed these steps on this tutorial https://wpgeodirectory.com/support/topic/conditional-tabs/.

    According to that, this line was added previously: if ( has_term ( ‘suggest’, ‘gd_placecategory’ ) ) {//rest of the function}

    This is the code that hides the tabs when the category is set. However the tabs are still appearing. Thank for you help.

    // this line tells the tabs function to run our new function to remove a tab
    add_filter(‘geodir_detail_page_tab_list_extend’, ‘geodir_detail_page_tab_list_remove_tab’);
    // this function removes the tab to the tabs list
    function geodir_detail_page_tab_list_remove_tab($tab_array)
    {
    // the $post var contains all the listing info so we can add conditions
    global $post;
    // only remove the tab if the post type is

    gd_place

    if ($post->gd_placecategory==’suggest’) {
    unset($tab_array[‘related_listing’]);//remove the tab
    unset($tab_array[‘post_map’]);//remove the tab
    unset($tab_array[‘special_offers’]);//remove the tab
    unset($tab_array[‘post_images’]);//remove the tab
    }
    return $tab_array;
    }

    #373176

    Paolo
    Site Admin
    Post count: 31211

    Hi,

    please provide a link and admin credentials and we will have a look at your code.

    Also let us know where you added it.

    Thanks

    #373218

    Diego Betancourt
    Free User
    Post count: 6

    Hi Paolo.

    I just fixed this line in the functions.php file of a child theme and works fine.

    // the $post var contains all the listing info so we can add conditions
    global $post;
    // only remove the tab if the post type is

    gd_place

    if ($post->post_type==has_term ( ‘suggest’, ‘gd_placecategory’ )) {{//rest of the function}

    Thanks for your help.

    #373275

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Thanks for letting us know 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount