default to other instead of profile

This topic contains 2 replies, has 2 voices, and was last updated by  yushan 8 years, 9 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #198220

    yushan
    Expired Member
    Post count: 55

    hi, when I click on a listing, by default, the “Profile” tab is selected/open, how do I make other tab like Map or Review or other custom tab to be the default? Thanks a million.

    #198404

    Kor
    Moderator
    Post count: 16516

    Hi Yushan,

    Yes, this can be achieved by using the code below. Please insert this into your child theme functions.php file. To set a default tab, insert “[‘is_active_tab’]=’1′” into a “$new_tab_array“. Example, check out the “reviews” section below.

    
    
    
    
    function override_whoop_filters() {
         remove_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend');
         add_filter('geodir_detail_page_tab_list_extend', 'my_geodir_detail_page_tab_list_extend');
    }
    add_action('init', 'override_whoop_filters');
    
    function my_geodir_detail_page_tab_list_extend($tab_array)
    {
        global $preview;
        if ($preview) {
            return $tab_array;
        }
        $new_tab_array = array();
        // here u can modify this array, u can create a completely new one too.
    
     if (isset($tab_array['post_profile'])) {
            $new_tab_array['post_profile'] = $tab_array['post_profile']; // set in new array      
            unset($tab_array['post_profile']);//unset in old one
        }
    
        if (isset($tab_array['reviews'])) {
            $new_tab_array['reviews'] = $tab_array['reviews'];// set in new array     
    		$new_tab_array['reviews']['is_active_tab']='1';
            unset($tab_array['reviews']);//unset in old one
        }
       
        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
        }
    
        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
        }
    
        if (isset($tab_array['post_info'])) {
            $new_tab_array['post_info'] = $tab_array['post_info'];// set in new array
            unset($tab_array['post_info']);//unset in old one
        }
    
        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
        }
    
        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
        }
    
        // 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;
    }
    #210864

    yushan
    Expired Member
    Post count: 55

    that worked, thank you much Kor Chung.
    John

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