adding a new listing tab

This topic contains 19 replies, has 9 voices, and was last updated by  Paolo 10 years, 2 months ago.

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

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #5536

    nvoi
    Free User
    Post count: 52

    How can I add a new tab in the listings?

    I don’t want to use ‘more’ but have 3 or four further tabs with various contents (e.g. widgets to place the associated events).

    #5542

    Guust
    Moderator
    Post count: 29970

    You can organise extra custom fields into fieldset, and then show them in the More Info tab. The Fieldsets will be headings, and the extra custom fields will be listed in the same order as in admin.
    To get extra tabs, you’d need to do some coding I think. Let’s ask Vikas.

    #7568

    sfamilia
    Buyer
    Post count: 82

    Any followup on the question of adding new tabs?

    #7664

    Vikas
    Full Member
    Post count: 1128

    Hi,
    There is no easy way to do it right now. U have to have wordpress action/hooks knowledge to achieve this.
    Please let me know if u are comfortable with that so i can write instructions for you.

    #7743

    nvoi
    Free User
    Post count: 52

    I am comfortable with that and would like to know more.

    #7986

    sfamilia
    Buyer
    Post count: 82

    Hi Vikas,

    I would greatly appreciate some instructions on adding new tabs.

    Thanks,
    Sal

    #8050

    salsaturation
    Free User
    Post count: 12

    I am interested in this as well.

    Thanks in advance

    Thomas

    #8185

    is
    Free User
    Post count: 10

    dito

    #8188

    Vikas
    Full Member
    Post count: 1128

    This is bit complicated process, let me prepare a doc during this weekend.
    I will post it asap.

    Thanks

    #8371

    nvoi
    Free User
    Post count: 52

    @Vikas, please share the documentation once ready.

    #8507

    Vikas
    Full Member
    Post count: 1128

    Hi,
    Thanks for ur patience.
    Here is how u can add new tabs in detail page tab lists.

    This consists of two steps.
    1. The tab itself
    2. The content which will appear once user will click on a tab.

    Lets assume you want to add a tab called ‘New Tab’ and when user will click on that tab a ‘Hello World!!’ content will appear.

    To add a tab with label ‘New Tab’ do the following in ur theme functions.php file:

    
    
    
    add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend') ;
    
    function geodir_detail_page_tab_list_extend($tab_array)
    {
     	$tab_array['my_new_tab'] = array( 
    										'heading_text' =>  __('New Tab',GEODIRECTORY_TEXTDOMAIN),
    										'is_active_tab' => false,
    										'is_display' =>  apply_filters('geodir_detail_page_tab_is_display', true, 'my_new_tab'),
    										'tab_content' => ''
    									);
    	return $tab_array ;
    }
    

    Now for the second part, to show Content when user click on that tab, do this:

    
    
    
    add_action('geodir_after_tab_content' ,'geodir_my_new_tab_content');
    function geodir_my_new_tab_content($tab_index)
    {
    	if($tab_index =='my_new_tab')
    	{
    		echo "Hello world!!";
    	}
    }
    

    Plz make sure that ‘my_new_tab'(tab index) is same as array index created in first step.

    Thanks
    Vikas

    #8511

    salsaturation
    Free User
    Post count: 12

    Hi Vikas

    Thank you very much just tried it and it works perfectly. Can I be a pain and ask if there is anyway we can pull fieldsets (or individual customfields) into the additional tabs?

    Thanks

    Thomas

    #8514

    nvoi
    Free User
    Post count: 52

    my question as well…

    #8829

    salsaturation
    Free User
    Post count: 12

    This is probably inefficient and really bad but this is what I ended up with to call individual fields… works for me and hope it helps someone or feel free to give me pointers to improve it. Hopefully Vikas will have an easier cleaner way soon

    
    
    add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend') ;
    
    function geodir_detail_page_tab_list_extend($tab_array)
    {
     $tab_array['prices_tab'] = array( 
    										'heading_text' =>  __('<i class="fa fa-gbp"></i> Prices',GEODIRECTORY_TEXTDOMAIN),
    										'is_active_tab' => false,
    										'is_display' =>  apply_filters('geodir_detail_page_tab_is_display', true, 'prices_tab'),
    										'tab_content' => ''
    									);
        
         	$tab_array['tripadvisor_tab'] = array( 
    										'heading_text' =>  __('Tripadvisor Reviews',GEODIRECTORY_TEXTDOMAIN),
    										'is_active_tab' => false,
    										'is_display' =>  apply_filters('geodir_detail_page_tab_is_display', true, 'tripadvisor_tab'),
    										'tab_content' => ''
    									);
        
    	return $tab_array ;
    }
    
    add_action('geodir_after_tab_content' ,'geodir_my_new_tab_content');
    function geodir_my_new_tab_content($tab_index)
    {
    	if($tab_index =='prices_tab')
    	{
            global $wpdb;
            $id = get_the_ID();
            $placePrices = $wpdb->get_var("SELECT geodir_place_price FROM geodir_gd_place_detail WHERE post_id = $id ");
            $ageRange = $wpdb->get_var("SELECT geodir_age_range FROM geodir_gd_place_detail WHERE post_id = $id ");
    
       // Echo the user's email address
         echo $ageRange;    
       echo $placePrices;
            
    	}
    
        
        if($tab_index =='tripadvisor_tab')
    	{
            global $wpdb;
            $id = get_the_ID();
            $freeCats = $wpdb->get_var("SELECT geodir_tripadvisor FROM geodir_gd_place_detail WHERE post_id = $id ");
    
       // Echo the user's email address
       echo $freeCats;
    	}
    }
    #10296

    leandrorosa
    Free User
    Post count: 168

    any news on this?

    would it be possible to add a tab (I understood how to do this), but is it possible to add a custom field to the tab? like the More Info tab that is created when you add a custom post text area.

    thanks!!

Viewing 15 posts - 1 through 15 (of 20 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