Listing tab order code snippet error
This topic contains 8 replies, has 3 voices, and was last updated by Giri 7 years, 5 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
July 1, 2017 at 8:48 pm #385394
Hi,
I read the tutorial on changing the order of the tabs in the listing but I’m getting errors when I try to change the order – probably don’t know what i’m doing properly.
I tried the code below:
// 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 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
// IMPORTANT the following code tells GeoDirectory that this is the new default active tab
$new_tab_array[‘reviews’][‘is_active_tab’]=’2′;
unset($tab_array[‘reviews’]);//unset in old one
}// 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’]=’3′;
unset($tab_array[‘post_profile’]);//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[‘post_info’])){
$new_tab_array[‘post_info’] = $tab_array[‘post_info’];// set in new array
unset($tab_array[‘post_info’]);//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 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 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 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
}// 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 ;
}I just need it in the following order:
1. map
2. reviews
3. profile
4. post info
5+ any for now (undecided)I put it in the functions child theme. If you can clearly show me how I can change the code for the order above that would be smashing
Thanks
RobJuly 1, 2017 at 10:33 pm #385396A valid license is required to view this reply.
You may need to login
OR
Buy either a Membership or valid license for this product.
Thanks, Team GeoDirectory!
July 2, 2017 at 8:15 pm #385439A valid license is required to view this reply.
You may need to login
OR
Buy either a Membership or valid license for this product.
Thanks, Team GeoDirectory!
July 2, 2017 at 8:43 pm #385440A valid license is required to view this reply.
You may need to login
OR
Buy either a Membership or valid license for this product.
Thanks, Team GeoDirectory!
July 3, 2017 at 7:47 am #385466A valid license is required to view this reply.
You may need to login
OR
Buy either a Membership or valid license for this product.
Thanks, Team GeoDirectory!
July 3, 2017 at 10:14 am #385479A valid license is required to view this reply.
You may need to login
OR
Buy either a Membership or valid license for this product.
Thanks, Team GeoDirectory!
July 3, 2017 at 10:46 am #385487A valid license is required to view this reply.
You may need to login
OR
Buy either a Membership or valid license for this product.
Thanks, Team GeoDirectory!
July 3, 2017 at 1:06 pm #385513A valid license is required to view this reply.
You may need to login
OR
Buy either a Membership or valid license for this product.
Thanks, Team GeoDirectory!
July 3, 2017 at 1:09 pm #385520A valid license is required to view this reply.
You may need to login
OR
Buy either a Membership or valid license for this product.
Thanks, Team GeoDirectory!
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket