adding a new listing tab
This topic contains 19 replies, has 9 voices, and was last updated by Paolo 10 years, 1 month ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: tabs
-
AuthorPosts
-
June 22, 2014 at 4:40 am #5536
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).
June 22, 2014 at 6:57 am #5542You 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.July 5, 2014 at 5:46 pm #7568Any followup on the question of adding new tabs?
July 7, 2014 at 12:40 pm #7664Hi,
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.July 8, 2014 at 4:57 am #7743I am comfortable with that and would like to know more.
July 10, 2014 at 12:30 am #7986Hi Vikas,
I would greatly appreciate some instructions on adding new tabs.
Thanks,
SalJuly 10, 2014 at 1:07 pm #8050I am interested in this as well.
Thanks in advance
Thomas
July 11, 2014 at 2:29 pm #8185dito
July 11, 2014 at 2:44 pm #8188This is bit complicated process, let me prepare a doc during this weekend.
I will post it asap.Thanks
July 14, 2014 at 5:15 am #8371@Vikas, please share the documentation once ready.
July 15, 2014 at 1:43 pm #8507Hi,
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
VikasJuly 15, 2014 at 1:59 pm #8511Hi 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
July 15, 2014 at 2:09 pm #8514my question as well…
July 17, 2014 at 1:17 pm #8829This 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; } }
July 29, 2014 at 10:10 pm #10296any 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!!
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket