Manish Keswani

Forum Replies Created

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • in reply to: Should We Use an SEO Plugin? #11201

    Manish Keswani
    Buyer
    Post count: 19

    remove this line from the function i provided

    
    
    wpseo_register_var_replacement( '%%in%%', 'in', 'advanced', 'Use this for in word before location' );
     }
    in reply to: Should We Use an SEO Plugin? #11200

    Manish Keswani
    Buyer
    Post count: 19

    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' );
     ?>
    

    Manish Keswani
    Buyer
    Post count: 19

    Thanks. it works but i used

    if($current_posttype != “post type”) {

    }

Viewing 3 posts - 16 through 18 (of 18 total)
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount