Add a new Tab in the listing detail page

It doesn't get easier than this...

One of the most frequent questions we get, about customizing GeoDirectory, is how to add a new tab for custom content (like data from another plugin) in the listings detail page.

Adding a Tab from the backend is possible for GD custom fields and fieldsets, but if you want to show anything more advanced, please use the example coe below.

This is very easy and you can proceed like this:

To add a new tab labelled “New Tab” add the following code inside your active theme’s functions.php file.

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

To show your custom content inside the tab, please add the following code inside your active theme’s functions.php file.

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

In this case we are simply showing the “Hello World!!” text. Instead of that you can add any code you want, like a shortcode, custom fields or any function to output other plugins’ content.

This will add the “New Tab” to all other custom post types you may have (Should you have the Events or the Custom Post Type addons installed).

If you wish to add a New Tab only to one custom post type, let’s say Events, you would have to slightly modify the 1st code snippet like in the example below.

<br />
add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend');</p>
<p>function geodir_detail_page_tab_list_extend($tab_array) {<br />
if ( 'gd_event' == get_post_type() )<br />
$tab_array['my_new_tab'] = array(<br />
'heading_text' =>  __('New Tab',GEODIRECTORY_TEXTDOMAIN),<br />
'is_active_tab' => false,<br />
'is_display' =>  apply_filters('geodir_detail_page_tab_is_display', true,'my_new_tab'),<br />
'tab_content' => ");<br />
return $tab_array ; }<br />

Developers you may be interested in reading more about this filter here :


If you want to explore the function that builds and returns the list of available tabs as an array,.you can look here:


We will go through this function in a future post about altering tabs order.

Did you use this function to create a more complex and awesome customization on your Directory. If you care about sharing it, let us know in the content and we will extend this post with your suggestions!

Published by Paolo

Paolo Tajani is the co-founder and growth hacker of AyeCode LTD. With his business partner Stiofan, they are the makers of the GeoDirectory, UsersWP and Invoicing plugins for WordPress. Paolo developed his first WordPress website in 2008. In 2011 he met Stiofan O'Connor and together they started building and marketing successful themes and plugins for WordPress. Today their products are used by +100.000 active websites.

9 thoughts on “Add a new Tab in the listing detail page

  1. Hi Paolo I would like to add a short code to my new tab but this would be different in each place ie “[mbhi_hours location=”your location name”] ” where “your location name” would be different for each place?

    1. Hi Peter,

      please ask for support in the forum:


  2. I also have an other question, but I did not see where to post it…

    How can I exclude the normal posts / pages from the search result searching in the listing / directory?
    If I search in the directory :
    The normal posts form WordPress also show up and I would like to disable that.

    Thanks for all,


    1. That’s probably caused by a conflicting plugin.

      Please submit any support question you may have in our support forum:

      A team of specialists will be more than happy to assist you.

      Thank you,

  3. Hi Paolo,

    OK, I will try that and tell you about it later.

    Thanks for your quick answer 😉


  4. Hi,

    Could someone please just add how to show up an existing field / new field in the new tab created?

    What’s the php code?



    1. there are 2 ways:

      1) custom_filed_key; //example $post->post_address


      or similar to WP custom field

      2) ID, ‘custom_field_key_goes_here’, true ); ?>

      Hope this helps,


  5. Hi,

    Is it possible to integrate buddypress compliments into a new listings tab?

    And where is the best place on the forum to post questions about the BuddyPress Compliments?



    1. Hi,

      no it isn’t, that plugin is made for buddypress profiles, not for listings.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.