Hi bonzoren
i have used this function which is provided in yoast seo plugin files to register extra variables. i used geodirectory_get_current_location_terms function to get current location and register this value to
%%current_location%%
variable which you can use to add location in title tag with the help of seo plugin. here is the function, copy it to theme functions (functions.php) file.
function retrieve_var1_replacement( $var1 ) {
$location_terms=geodir_get_current_location_terms();
$city=$location_terms['gd_city'];
$region=$location_terms['gd_region'];
$country=$location_terms['gd_country'];
if(!empty($city))
return $city ;
if(!empty($region))
return $region ;
if(!empty($country))
return $country ;
return '';
}
function register_my_plugin_extra_replacements() {
wpseo_register_var_replacement( '%%current_location%%', 'retrieve_var1_replacement', 'advanced', 'Use this is for current location' );
wpseo_register_var_replacement( '%%in%%', 'in', 'advanced', 'Use this for in word before location' );
}
add_action( 'wpseo_register_extra_replacements', 'register_my_plugin_extra_replacements' );
?>