Adding Tabs

This topic contains 6 replies, has 3 voices, and was last updated by  Kent Grabau 6 years, 9 months ago.

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

Open Support Ticket

Tagged: ,

  • Author
    Posts
  • #417407

    Kent Grabau
    Expired Member
    Post count: 67

    I found the script for adding tabs to the listings but I need certain tabs to show only on certain categories. Like a “Menu” tab for Restaurants. Obviously, a “Menu” tab wouldn’t be appropriate for a Painter. Here’s is the code for adding tabs. Is there anything I can do to make this work the way I need?

    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 ; }

    #417500

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    GeoDirectory has built in support for CPTs with the Custom Post Type Addon. If your directory requires a significant amount of special handling or differentiation based on the listing types, then the Custom Post Types functionality is for you.

    You can use the Custom Post Types functionality to create additional post types, and each post type can have different fieldsets with specialized fields.

    If you don’t want to use that, then you can of course customize your directory site any way you like, and make use of the developer code samples like the one above. If you need help with that customization, you can contact a GD Expert here: https://geodirectoryexperts.com

    #417576

    Kent Grabau
    Expired Member
    Post count: 67

    So, how would I edit the above code to add a “Menu” tab just for the “Restaurant” CPT? Would this work?

    if ( ‘gd_restaurants’ == get_post_type() )

    But, how would I create another custom tab for another CPT? Just add more of these scripts with the respective gd types?

    #417591

    Alex Rollin
    Moderator
    Post count: 27815

    I’ll flag this for the developers and they can let us know if there’s an easy customization available.

    #417593

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    What you said will probably work yes.

    Stiofan

    #417605

    Kent Grabau
    Expired Member
    Post count: 67

    I tried using this code but the new tab isn’t showing. It should show in the Businesses type. http://www.hometowntourusa.com

    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_businesses’ == get_post_type() )
    $tab_array[‘my_new_tab’] = array(
    ‘heading_text’ => __(‘More’,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 ; }

    #417609

    Kent Grabau
    Expired Member
    Post count: 67

    Never mind. I had a typo.

    But, now that I have a new tab showing, how does the author populate that tab with info? When I clicked to edit the tab, there’s no field for that tab.

Viewing 7 posts - 1 through 7 (of 7 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