How to change default tab (from profile to review)?

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

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

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #46984

    Guust
    Moderator
    Post count: 29970

    @hezekiah
    What is the full code you used, what did you replace //function here with?

    #46985

    hezekiah
    Buyer
    Post count: 115

    thanks. used the:

    // begin change order tabs //
    /** https://wpgeodirectory.com/support/topic/how-to-change-default-tab-from-profile-to-review/#post-24021 **/

    add_filter(‘geodir_detail_page_tab_list_extend’, ‘geodir_detail_page_tab_list_extend’) ;

    function geodir_detail_page_tab_list_extend($tab_array)
    {
    // here u can modify this array, u can create a completely new one too.
    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_profile’])){
    $new_tab_array[‘post_profile’] = $tab_array[‘post_profile’]; // set in new array
    $new_tab_array[‘post_profile’][‘is_active_tab’]=”;
    unset($tab_array[‘post_profile’]);//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[‘special_offers’])){
    $new_tab_array[‘special_offers’] = $tab_array[‘special_offers’];// set in new array
    unset($tab_array[‘special_offers’]);//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_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_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 ;
    }

    // end change order tabs //

    as function.It worked well for reviews. but couldnt add the if statement.

    #46987

    Guust
    Moderator
    Post count: 29970

    Did you add the closing ” } ” at the end?

    if ( ‘gd_place’ == get_post_type() ) {

    all your code ending as …
    // 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 ;
    }

    }
    // end change order tabs //

    #46988

    hezekiah
    Buyer
    Post count: 115

    Yes i did. Below is the full code:

    add_filter(‘geodir_detail_page_tab_list_extend’, ‘geodir_detail_page_tab_list_extend’) ;

    if ( ‘gd_place’ == get_post_type() ) {
    function geodir_detail_page_tab_list_extend($tab_array)
    {
    // here u can modify this array, u can create a completely new one too.
    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_profile’])){
    $new_tab_array[‘post_profile’] = $tab_array[‘post_profile’]; // set in new array
    $new_tab_array[‘post_profile’][‘is_active_tab’]=”;
    unset($tab_array[‘post_profile’]);//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[‘special_offers’])){
    $new_tab_array[‘special_offers’] = $tab_array[‘special_offers’];// set in new array
    unset($tab_array[‘special_offers’]);//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_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_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 ;
    }
    }

    #46989

    Guust
    Moderator
    Post count: 29970

    I’ll get Paolo to have a better look.

    #47017

    hezekiah
    Buyer
    Post count: 115

    ok. will wait.

    #47101

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    the IF statement should be inside the function:

    Have a look here https://wpgeodirectory.com/re-order-tabs-in-a-listing-detail-page/, where it says: Different orders only for 1 Custom Post Type

    Let us know how you went,

    Thanks

Viewing 7 posts - 16 through 22 (of 22 total)

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

Open Support Ticket