How to change default tab (from profile to review)?
This topic contains 21 replies, has 5 voices, and was last updated by Paolo 9 years, 4 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: tab
-
AuthorPosts
-
July 26, 2015 at 12:40 am #46984
@hezekiah
What is the full code you used, what did you replace //function here with?July 26, 2015 at 12:44 am #46985thanks. 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.
July 26, 2015 at 12:51 am #46987Did 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 //July 26, 2015 at 12:56 am #46988Yes 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 ;
}
}July 26, 2015 at 1:04 am #46989I’ll get Paolo to have a better look.
July 26, 2015 at 10:45 pm #47017ok. will wait.
July 27, 2015 at 7:18 pm #47101Hi,
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
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket