Re-order Tabs in events detail page

This topic contains 9 replies, has 3 voices, and was last updated by  m forbes 6 years, 5 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #402946

    m forbes
    Full Member
    Post count: 338

    Hi, a good while back I added a custom tab via snippet to my functions file. I can try to find the (very) old post… I recently decided to have all of the detail info in list form versus tabs and this custom tab is at the end of the info after reviews. I am trying to move it directly under the profile blurb. I did look over the _re-order tabs page and kind of glazed over, as this code also removes the info from the sidebar :). How might I adjust the code to move this tab? Any help is greatly appreciated!

    
    
    // GeoDirectory: Display event schedule as a tab on event detail page.
    function gd_show_event_schedule_as_tab( $template ) {
        if ( has_filter( 'geodir_detail_page_sidebar_content', 'geodir_event_detail_page_sitebar_content' ) ) {
            remove_filter( 'geodir_detail_page_sidebar_content', 'geodir_event_detail_page_sitebar_content', 2 );
            add_filter( 'geodir_detail_page_tab_list_extend', 'gd_detail_page_tab_event_schedule', 10, 1 );
            add_action( 'geodir_after_tab_content', 'gd_detail_page_tab_content_event_schedule', 10, 1 );
        }
        
        return $template;
    }
    add_filter( 'template_include', 'gd_show_event_schedule_as_tab', 10 );
    
    function gd_detail_page_tab_event_schedule( $tab_array ) {   
        if ( 'gd_event' == get_post_type() ) {
            $tab_array['event_schedule'] = array( 
                'heading_text' =>  __( 'Date n Time', 'geodirevents' ),
                'is_active_tab' => false,
                'is_display' =>  apply_filters( 'geodir_detail_page_tab_is_display', true, 'event_schedule' ),
                'tab_content' => ''
            );
        }
        
        return $tab_array ;
    }
    
    function gd_detail_page_tab_content_event_schedule( $tab ) {
        if ( $tab == 'event_schedule' ) {
            geodir_event_show_shedule_date();
        }
    }

    Thanks!

    #402947

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    We provide the page for re-ordering your tabs here:

    https://wpgeodirectory.com/re-order-tabs-in-a-listing-detail-page/

    You can just drop that in and re-order it as needed.

    Your custom tab just gets inserted into the list of tabs in the order you need.

    You can add a tab in the backend, as it says here, if you want to get rid of some of your custom code that is hard to manage: https://wpgeodirectory.com/add-a-new-tab-in-the-listing-detail-page/

    Let us know how it works out for you.

    #402951

    m forbes
    Full Member
    Post count: 338

    Yes, I mentioned that I looked at that page. So what you are saying is, the order in which the tabs (code for) is entered is the order they show on the detail page? I am just looking to change the order for the events page. Don’t I need the code that I have added that moves the time, which by default shows in the sidebar?

    In example: “Different orders only for 1 Custom Post Type” and I want the custom tab (time n date) after profile,

    I would use this code, add my custom code second in string, change out all reference of gd_place to gd_events in the rest of the code, and it will work?

    #402955

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    Yes! I am sorry we have not made our documentation clearer even as the list view has become more popular.

    When you follow the instructions for reordering tabs, yes, it does indeed change the order of the detail page list, too. The tabs are really just a different set of css/js applied to a list.

    So, yes, the place to start is with a CPT and the tab/list order. Get that setup in the right order first.

    The instructions here have samples for different CPTs and more: https://wpgeodirectory.com/re-order-tabs-in-a-listing-detail-page/

    I mentioned that you can add a custom tab in the backend. https://wpgeodirectory.com/docs/core-place-settings/#fieldset (and then a snippet for the same with a sample of how to add custom content: https://wpgeodirectory.com/add-a-new-tab-in-the-listing-detail-page/ )

    I think that it might be easier to get your re-ordered tabs/list setup first, and then add your facebook comments into the new tab order after it is all setup in the order that you want.

    To take another step back, rather than doing any of this on your live site or even your production (nonpublic site) you could make a temporary CPT on your staging site to work through the proof of concept, and, when it is ready, switch it over to work with the right CPT on your live site.

    #402959

    m forbes
    Full Member
    Post count: 338

    I am getting more confused now :).

    Unless things have changed considerably, the snippet I have for the “tab” date and time” needs to remain. Maybe it stays as it’s own snippet and has nothing to do with what I am asking here.

    Here is the thread where I was given the snippet to remove date and time out of sidebar and in to tab area. https://wpgeodirectory.com/support/topic/another-detail-sidebar-question-events-date-and-time/

    Can you start me out on how I am trying to rearrange “tabs” in events, with date and time being below profile? If you can give me the first two…profile and date and time, I can figure out the rest.

    You mention facebook comments, and now I am even more confused :).

    thanks

    #403016

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Please provide wp-admin and a link to an example page, and explain what you are trying to achieve, there are a few hooks u can use to add info to profile.

    Stiofan

    #403072

    m forbes
    Full Member
    Post count: 338

    Hi Stiofan,

    I have the snippet in place that took the date and time of event out of the sidebar and put it into a tab. That works fine. The date and time tab resides under the reviews (last tab). Which was fine in tab view but not fine in list view. Now I want it under profile.

    The snippet I am referring to is in my first post on this thread.

    Unless there is a better way, I think what I need to do is follow the instructions for “Different orders only for 1 Custom Post Type”, replacing gd_place with gd_events, and using the $tab_array[‘event_schedule’] from above snippet for the tab I want to move, correct?

    I will give you the details you asked for in next post.

    thanks again :).

    #403073

    m forbes
    Full Member
    Post count: 338
    This reply has been marked as private.
    #403248

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    I have updated your snippet now, it is below for reference:

    
    
    function gd_detail_page_tab_event_schedule( $tab_array ) {   
        if ( 'gd_event' == get_post_type() ) {
    
        $tab_array_new = array();
    
        foreach($tab_array as $key=>$tab){
    
            $tab_array_new[$key] = $tab;
    
            if($key=='post_profile'){
                $tab_array_new['event_schedule'] = array( 
                'heading_text' =>  __( 'Date n Time', 'geodirevents' ),
                'is_active_tab' => false,
                'is_display' =>  apply_filters( 'geodir_detail_page_tab_is_display', true, 'event_schedule' ),
                'tab_content' => ''
                );
            }
    
        }
    
    return $tab_array_new;
            
        }
        
        return $tab_array ;
    }

    Thanks,

    Stiofan

    #403309

    m forbes
    Full Member
    Post count: 338

    got it, thanks so much!

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

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

Open Support Ticket