I am using Geodirectory v1. I set a fieldset to have its own tab. However, I would like to change the name of that fieldset tab to be something based on the user’s input. Can you provide some guidelines to achieve this? For example, what filter or action to use? I tried the code snippet as follows but it failed to give me what I wanted.
In the code below, please note that:
house1 is the frontend title of the fieldset and station1 if the html variable name of a custom field that receives user input. I want the tab of the fieldset to be whatever the user input into this custom field.
add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend') ;
function geodir_detail_page_tab_list_extend($tab_array)
{
global $post;
if(isset($tab_array['post_map'])){
$new_tab_array['post_map'] = $tab_array['post_map'];// set in new array
$new_tab_array['post_map']['is_active_tab']='1';
unset($tab_array['post_map']);//unset in old one
}
if(isset($tab_array['post_profile'])){
$new_tab_array['post_profile'] = $tab_array['post_profile']; // set in new array
$new_tab_array['post_profile']['is_active_tab']='';
unset($tab_array['post_profile']);//unset in old one
}
foreach($tab_array as $key=>$tab){
$new_tab_array[$key]=$tab;
}
// My customized code below (house1 is the title of the fieldset // and station1 if the html variable name of a custom field that // receives user input and that I want to be the name of the tab // of the fieldset)
if(!empty($post->geodir_station1)){
$new_tab_array['gd_tab_house1'] = array(
'heading_text' => __($post->geodir_station1,GEODIRECTORY_TEXTDOMAIN),
'is_active_tab' => false,
'is_display' => apply_filters('geodir_detail_page_tab_is_display', true,'gd_tab_house1'),
'tab_content' => ”);
return $new_tab_array ;
}