Reorder Tabs
This topic contains 10 replies, has 3 voices, and was last updated by Simone 9 years, 10 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
June 19, 2015 at 5:56 pm #43097
Hi,
There are 3 things I would like to do, but can’t seem to get them right yet, I’m very much new at this. I’ve attached an image of the details section of the site for reference.1. I’d like to eliminate the ‘Profile’ section.
2. I’d like to move the ‘Basic Information’ tab, so that it sits where the ‘Profile’ tab used to be.
3. I’d like for the content in the ‘Basic Information’ tab to be visible as soon as you open the page.I tried following the directions seen here: https://wpgeodirectory.com/support/topic/exclude-selected-tabs-from-detail-page-if-empty/#post-7305 in order to reorder the tabs. But the field set “Basic Information”, which I set as a tab on the details page, didn’t include an HTML variable field, so I just used “basic_information” to represent the tab. That might have to do with why it isn’t working. Here is what I ultimately added to my functions.php file on the child theme:
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['basic_information'])){ $new_tab_array['basic_information'] = $tab_array['basic_information']; // set in new array unset($tab_array['basic_information']);//unset in old one } 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['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 } if(isset($tab_array['reviews'])){ $new_tab_array['reviews'] = $tab_array['reviews'];// set in new array unset($tab_array['reviews']);//unset in old one } 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 ; }
Thank you in advance for your help!
PaolaJune 19, 2015 at 10:01 pm #43126Hello Paola,
how come the basic information is without html variable name? Is it a fieldset? However, the default tab must be set it as active with$new_tab_array['basic_information']['is_active_tab']='1';
place it before
unset($tab_array['basic_information']);//unset in old one
and you should remove the Profile from the active tabs
$new_tab_array['post_profile']['is_active_tab']='';
place it before
unset($tab_array['post_profile']);//unset in old one
June 19, 2015 at 10:14 pm #43128Thank you so much for the response! Yes, it is a fieldset.
June 19, 2015 at 10:47 pm #43129This is what I’ve put in the child theme’s function.php now:
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['basic_information'])){ $new_tab_array['basic_information'] = $tab_array['basic_information']; // set in new array $new_tab_array['basic_information']['is_active_tab']='1'; unset($tab_array['basic_information']);//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 } if(isset($tab_array['reviews'])){ $new_tab_array['reviews'] = $tab_array['reviews'];// set in new array unset($tab_array['reviews']);//unset in old one } 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 ; }
It’s not quite right yet. I’ve attached an image of what you can see now as soon as you open the page. Maybe the problem has to do with the fact that the “Basic Information” tab is a fieldset. I don’t know what I should use as the HTML variable name for this tab, like, instead of using the name “basic_information”. I hope you can point me in the right direction. Thank you once again for your help!
PaolaJune 19, 2015 at 10:55 pm #43131Ciao Paola, this is a not-so-common issue (the handling of a tab without a html variable name) so I will ask to Stiofan and get back at you as soon as I will know something.
June 19, 2015 at 11:00 pm #43132Thank you so much Simone! I really appreciate it.
June 19, 2015 at 11:01 pm #43133OK wait, add the following function in your functions.php file
function geodir_detail_page_tab_list_extend_profile($tab_array) { print_r($tab_array); }
This will output the tab index, so you can see what’s the name of the fieldset for the basic information, once you know it you can use the previously posted function, changing the name of the basic_information you used before
June 19, 2015 at 11:21 pm #43136I’ve added the code to the functions.php and saved it. I don’t really know where to look for the tab index output tho. I’ve attached an image for reference. Nothing has really changed since saving the code. Again, thank you so much for the help.
June 20, 2015 at 2:48 pm #43170Hi Paola,
my bad I gave Simone an incomplete information.
You need to call that function via a filter or it will not appear anywhere.
This:
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); }
Will print the array with all info instead of the tabs. By doing so you can find the tab index for the tab with fieldset. At this point remove the above function and use the correct tab index for your function to re-order tabs.
Let us know if this works for you.
Thanks for your patience!
June 21, 2015 at 12:15 am #43203Brilliant! Thank you so much Paolo & Simone for all your help! You’ve been outstanding! The plugin is absolutely amazing and your support has been absolutely amazing! I’m off to purchase the membership now. Grazie mille! 😀
June 21, 2015 at 10:57 am #43220You’re very welcome Paola, enjoy GD! 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket