order of Tabs

This topic contains 8 replies, has 2 voices, and was last updated by  BALDARI AUDELINE 6 years, 3 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #416130

    BALDARI AUDELINE
    Expired Member
    Post count: 74

    I would like to change the order of tabs ?

    https://www.haloasso.fr/place/france/ile-de-france/paris/coegf-a-paris-10/#post_profile

    I would like organization of tabs :

    La Présentation > La Fierté > Les Photos > Les Avis > L’Itinéraire > Nos Suggestions

    #416205

    Kor
    Moderator
    Post count: 16516

    Hi Baldari,

    Here is an article that explains how you can achieve this https://wpgeodirectory.com/re-order-tabs-in-a-listing-detail-page/

    Thanks!

    #416241

    BALDARI AUDELINE
    Expired Member
    Post count: 74

    I pasted the code in the snippets plugin, but it doesn’t work…

    I can’t have this order : La Présentation > La Fierté > Les Photos > Les Avis > L’Itinéraire > Nos Suggestions

    🙁

    #416245

    Kor
    Moderator
    Post count: 16516

    Hi Baldari,

    Could you tell us how do you want it to look like? Also, share your WP admin access here in private reply.

    Thanks!

    #416248

    BALDARI AUDELINE
    Expired Member
    Post count: 74
    This reply has been marked as private.
    #416252

    Kor
    Moderator
    Post count: 16516

    Hi Baldari,

    Could you please check now?

    Thanks!

    #416253

    BALDARI AUDELINE
    Expired Member
    Post count: 74

    the order is perfect but when you open the windows, it’s not the first tab (“Présentation” or “Evénement”) that is open…

    #416431

    Kor
    Moderator
    Post count: 16516

    Hi Baldari,

    Just made some adjustments to the custom PHP code.

    
    
    // this is the snippet that adds the filter, calling the function below. 
    add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend') ;
     
    // this is the function that does the re-ordering that we call with the add filter snippet above.
    function geodir_detail_page_tab_list_extend($tab_array)
    {
    
     // here you can modify the array and re-arrange tabs as you wish, you can create a completely new array too.
     
      
     
        // this is the post profile tab, by default is the 1st
        if(isset($tab_array['post_profile'])){
             $new_tab_array['post_profile'] = $tab_array['post_profile']; // set in new array
             // IMPORTANT the following code tells GeoDirectory that this is no longer the default active tab 
    	  $new_tab_array['post_profile']['is_active_tab']='1';
             unset($tab_array['post_profile']);//unset in old one
         }
       // this is the speacial offer tab, appears only if there are special offers and by default is the 5th
        if(isset($tab_array['special_offers'])){
             $new_tab_array['special_offers'] = $tab_array['special_offers'];// set in new array
             unset($tab_array['special_offers']);//unset in old one
         }
       // this is the post info tab (optional for custom fields), by default, if available, is the 2nd.
        if(isset($tab_array['geodir_fierte'])){
             $new_tab_array['geodir_fierte'] = $tab_array['geodir_fierte'];// set in new array
             unset($tab_array['geodir_fierte']);//unset in old one
         }
       
      
       // this is the images tab, by default is the 3rd
        if(isset($tab_array['post_images'])){
             $new_tab_array['post_images'] = $tab_array['post_images'];// set in new array
             unset($tab_array['post_images']);//unset in old one
        }
      
      
        // this is the review tab, by default is the 7th, but here we moved it to position 1.
        if(isset($tab_array['reviews'])){
             $new_tab_array['reviews'] = $tab_array['reviews'];// set in new array 
             unset($tab_array['reviews']);//unset in old one
         }
     
       
        // this is the map tab, by default is the 6th
        if(isset($tab_array['post_map'])){
             $new_tab_array['post_map'] = $tab_array['post_map'];// set in new array
             unset($tab_array['post_map']);//unset in old one
         }
      
       // this is the related listing tab, it is optional and by default is the 8th
        if(isset($tab_array['related_listing'])){
            $new_tab_array['related_listing'] = $tab_array['related_listing'];// set in new array
            unset($tab_array['related_listing']);//unset in old one
        }
     
       
      
        // this is the video tab, appears only if there are videos and by default is the 4th
         if(isset($tab_array['post_video'])){
             $new_tab_array['post_video'] = $tab_array['post_video'];// set in new array
             unset($tab_array['post_video']);//unset in old one
        }
     
       
     
        // this is the related listing tab, it is optional and by default is the 8th
        if(isset($tab_array['related_listing'])){
            $new_tab_array['related_listing'] = $tab_array['related_listing'];// set in new array
            unset($tab_array['related_listing']);//unset in old one
        }
         
        // now we set any remaining tabs that have not been assigned an order
        foreach($tab_array as $key=>$tab){
        $new_tab_array[$key]=$tab;
        }
     
        return $new_tab_array ;
    }
    #416467

    BALDARI AUDELINE
    Expired Member
    Post count: 74

    it works !

    Thank you very much Kor

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

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

Open Support Ticket