Details tabs
This topic contains 12 replies, has 4 voices, and was last updated by Stiofan O’Connor 7 years, 10 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: new tab
-
AuthorPosts
-
December 31, 2016 at 3:50 am #334005
Hi,
I’ve used some of your support docs to change the tab order and also add a new tab. But I can’t find anything on how you add specific fields to the new tab OR if there is a way to add new fields to existing tabs (e.g. add address to the map page).
{echo “Hello world!!”;} – what would I put here instead? Do you use the html variable name? Or…?
My code so far
/////////////////tabs
// 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 adds new tab and does the re-ordering that we call with the add filter snippet above.
function geodir_detail_page_tab_list_extend($tab_array)
{//Adding new tab
$tab_array[‘contact_tab’] = array(
‘heading_text’ => __(‘Contact’,GEODIRECTORY_TEXTDOMAIN),
‘is_active_tab’ => false,
‘is_display’ => apply_filters(‘geodir_detail_page_tab_is_display’, true,’contact_tab’),
‘tab_content’ => ”);// here you can modify the array and re-arrange tabs as you wish, you can create a completely new array too.
// this is the post info tab (optional for custom fields), but moved to 1st.
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 review tab, by default is the 7th, but here we moved it to position 2.
if(isset($tab_array[‘reviews’])){
$new_tab_array[‘reviews’] = $tab_array[‘reviews’];// set in new array
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’]=”;
unset($tab_array[‘post_profile’]);//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 ;
}// Add new content to the new tab
add_action(‘geodir_after_tab_content’ ,’geodir_contact_tab_content’);
function geodir_contact_tab_content($tab_index)
{
if($tab_index ==’contact_tab’)
{echo “Hello world!!”;}
}
?>December 31, 2016 at 4:55 am #334011The easiest way to add a tab and fields in the tab is by creating a fieldset and ordering custom fields below it.
https://wpgeodirectory.com/docs/core-place-settings/#fieldset
https://wpgeodirectory.com/docs/core-place-settings/December 31, 2016 at 5:35 am #334015Hi,
OK I didn’t realise that. Thanks but…..
Two problems:
1. I can’t add the address as it doesn’t have that option of ‘Details page own tab’
2. The tab name in the URL is not good (I completed all of the names in the fieldset): https://medrate.asia/sg/practices/singapore/a-hospital-yrl-subscription/#gd_tab_1December 31, 2016 at 5:53 am #334019Mmmmm, can’t help you with either, so Let’s ask the others. You might have to wait until after the weekend though.
Happy New Year 🙂
December 31, 2016 at 6:13 am #334052OK thanks
December 31, 2016 at 6:13 am #334053Happy New Year 🙂
December 31, 2016 at 4:43 pm #334251Hi Cyril,
there are plenty of examples in the forum:
You just need to search a bit…
Please see: https://wpgeodirectory.com/support/topic/echo-functionality-in-first-tab/#post-168947
Let us know if that helps, however remember this is considered a customization.
Thanks
January 1, 2017 at 1:35 pm #334693Hi,
I’ve added the fields to the custom tab but it only adds the text, with no formatting, doesn’t include the specified fa-fa images etc.
https://medrate.asia/sg/practices/singapore/a-hospital-yrl-subscription/#contact_tabIs there to keep them looking as per normal?
OR how do I add the address to a fieldset tab – there isn’t an option?
January 1, 2017 at 2:50 pm #334746Hi Cyril,
Adding the icon too requires extra code, please search the forum for more examples or better hire a developer to help you out.
As I said, this is beyond support.
Thanks
January 2, 2017 at 2:50 am #335104OK understood but then please can you help with what is supported: fieldsets.
How do I add the address to a fieldset tab – there isn’t an option as with the other fields
January 2, 2017 at 6:21 pm #335502Hi Cyril,
I have changed this so the category and address can be shown in their own tab, this will be in the next version but you can use the dev version if u wish: https://github.com/GeoDirectory/geodirectory
Thanks,
Stiofan
January 3, 2017 at 7:59 am #335704Hello
That is amazing thank you so much 😊
January 3, 2017 at 10:37 am #335731You are welcome 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket