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 Ticket

Tagged: 

  • Author
    Posts
  • #334005

    cyril lansade
    Expired Member
    Post count: 150

    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!!”;}
    }
    ?>

    #334011

    Guust
    Moderator
    Post count: 29970

    The 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/

    #334015

    cyril lansade
    Expired Member
    Post count: 150

    Hi,

    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_1

    #334019

    Guust
    Moderator
    Post count: 29970

    Mmmmm, 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 🙂

    #334052

    cyril lansade
    Expired Member
    Post count: 150

    OK thanks

    #334053

    cyril lansade
    Expired Member
    Post count: 150

    Happy New Year 🙂

    #334251

    Paolo
    Site Admin
    Post count: 31206

    Hi 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

    #334693

    cyril lansade
    Expired Member
    Post count: 150

    Hi,

    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_tab

    Is there to keep them looking as per normal?

    OR how do I add the address to a fieldset tab – there isn’t an option?

    #334746

    Paolo
    Site Admin
    Post count: 31206

    Hi 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

    #335104

    cyril lansade
    Expired Member
    Post count: 150

    OK 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

    #335502

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi 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

    #335704

    cyril lansade
    Expired Member
    Post count: 150

    Hello

    That is amazing thank you so much 😊

    #335731

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You are welcome 🙂

Viewing 13 posts - 1 through 13 (of 13 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount