Variables location use for yoast

This topic contains 2 replies, has 2 voices, and was last updated by  tuyentran 9 years, 5 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #22195

    tuyentran
    Free User
    Post count: 64

    I found this script in forum, but have some problem i hope somebody can fix this

    
    
    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' );
    		
     }
     add_action( 'wpseo_register_extra_replacements', 'register_my_plugin_extra_replacements' );
     ?>

    I use in location “quận tân bình” but result is “quan-tan-binh” how to fix this to see result is “quận tân bình”?

    And i need 1 variable include “city, state, country”

    #22203

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    The location terms always store the slug not the actual name, you will then ahve to query the db to get the name for the matching slug.

    Stiofan

    #22213

    tuyentran
    Free User
    Post count: 64

    can you code script here? And this script not get “everywhere” when in everywhere location.

Viewing 3 posts - 1 through 3 (of 3 total)

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

Open Support Ticket