Adding new tab to listing details

This topic contains 5 replies, has 2 voices, and was last updated by  Paolo 7 years, 9 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #364926

    Michele
    Expired Member
    Post count: 54

    I followed the documentation from (https://wpgeodirectory.com/add-a-new-tab-in-the-listing-detail-page/) and added the code to my theme’s functions.php file. The code works fine but, when I use the code to limit the new tab to my custom post type gd_events, the tab disappears.

    Here is the code that should work but, does not:

    if ( ‘gd_event’ == get_post_type() )
    { add_filter(‘geodir_detail_page_tab_list_extend’, ‘geodir_detail_page_tab_list_extend’) ; }

    function geodir_detail_page_tab_list_extend($tab_array) {
    $tab_array[‘my_new_tab’] = array(
    ‘heading_text’ => __(‘New Tab’,GEODIRECTORY_TEXTDOMAIN),
    ‘is_active_tab’ => false,
    ‘is_display’ => apply_filters(‘geodir_detail_page_tab_is_display’, true,’my_new_tab’),
    ‘tab_content’ => ”);
    return $tab_array ; }

    #364953

    Paolo
    Site Admin
    Post count: 31206

    Please try this:

    
    
    add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend');
     
    function geodir_detail_page_tab_list_extend($tab_array) {   
    if ( 'gd_event' == get_post_type() )
    $tab_array['my_new_tab'] = array( 
    'heading_text' =>  __('New Tab',GEODIRECTORY_TEXTDOMAIN),
    'is_active_tab' => false,
    'is_display' =>  apply_filters('geodir_detail_page_tab_is_display', true,'my_new_tab'),
    'tab_content' => '');    
    return $tab_array ; }

    I updated the tutorial too.

    Thanks for spotting that error.

    #364956

    Michele
    Expired Member
    Post count: 54

    Works perfectly now. Thank You!!!

    Cheers,
    Michele

    #364959

    Paolo
    Site Admin
    Post count: 31206
    This reply has been marked as private.
    #364962

    Michele
    Expired Member
    Post count: 54

    Done 🙂

    #364967

    Paolo
    Site Admin
    Post count: 31206
    This reply has been marked as private.
Viewing 6 posts - 1 through 6 (of 6 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