re-order tabs
This topic contains 5 replies, has 3 voices, and was last updated by Paolo 8 years, 5 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: tab order
-
AuthorPosts
-
June 15, 2016 at 12:30 pm #208881
Hi all,
wonder if anyone can help…
What am I doing wrong?!Set up custom tab, want it to appear after images, but won’t!
Any advice appreciated. Thank you.// 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 images tab 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_special_offers2'])){ $new_tab_array['post_special_offers2'] = $tab_array['post_special_offers2'];// set in new array $new_tab_array['post_special_offers2']['is_active_tab']='1'; unset($tab_array['post_special_offers2']);//unset in old one } // this is the special offer tab if(isset($tab_array['special_offers'])){ $new_tab_array['special_offers'] = $tab_array['special_offers'];// set in new array $new_tab_array['special_offers']['is_active_tab']='5'; unset($tab_array['special_offers2']);//unset in old one } // this is the post info tab (optional for custom fields) if(isset($tab_array['post_info'])){ $new_tab_array['post_info'] = $tab_array['post_info'];// set in new array $new_tab_array['post_info']['is_active_tab']='4'; unset($tab_array['post_info']);//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 ; } // this is the post profile tab 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']='98'; unset($tab_array['post_profile']);//unset in old one } // this is the map tab if(isset($tab_array['post_map'])){ $new_tab_array['post_map'] = $tab_array['post_map'];// set in new array $new_tab_array['post_map']['is_active_tab']='99'; unset($tab_array['post_map']);//unset in old one } // this is the related listing tab if(isset($tab_array['related_listing'])){ $new_tab_array['related_listing'] = $tab_array['related_listing'];// set in new array $new_tab_array['related_listing']['is_active_tab']='100'; unset($tab_array['related_listing']);//unset in old one }
June 15, 2016 at 3:31 pm #208986Hi Sumi,
I’ve just checked the code and it seems incorrect. Could you tell us how do you want to arrange your tabs? Just list it down here and we’ll supply you the correct code. Also, do you think you can share temp admin access to your site so we can take a better look? You can post the details here using the private reply option below.
Here’s a reference that might help achieve what you needed there. https://wpgeodirectory.com/re-order-tabs-in-a-listing-detail-page/
Thanks!
June 15, 2016 at 4:38 pm #209013Probably you are also using the wrong tab index name for your custom tab, where did you get that from?
In the article linked by Kor, please review this part:
If you paste the follwing code snippet in your active theme’s functions.php file instead of the previous function, tabs will disappear from the listing details page and instead you will see the array with all its info, including all tab indexes.
add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend_profile') ; function geodir_detail_page_tab_list_extend_profile($tab_array) { print_r($tab_array); }
By doing so you can find the tab index for your custom tab made with fieldset. At this point remove the above code snippet and use the correct tab index for your function to re-order tabs.
Let us know if that helped.
Thanks
June 15, 2016 at 5:07 pm #209033Hi
tried print_r, but didnt realise at wrong tab index name until you said, lol.
played around – working, now.
Sorted.
Thanks guys.June 15, 2016 at 5:08 pm #209034This reply has been marked as private.June 15, 2016 at 5:12 pm #209040Good job! 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket