N
N
Narek Tarverdyan2015-09-05 18:13:28
Geolocation
Narek Tarverdyan, 2015-09-05 18:13:28

Geotargeting on wordpress, how to implement?

Hello. I ran into a problem that I have not yet encountered, namely, to implement geotargeting, show / hide / change content for some Russian cities.
I found one plugin called Geotargeting Pro, but it's paid. Does anyone know free analogues?
In fact, you need to change the content of some blocks based on the user's location, there is a phone number, contacts, some complex blocks like a portfolio with many pictures, etc., so it would be ideal if you can use the plugin in the template code, for example, as it is implemented on Geotargeting Pro

<?php
/**
 * Main function that return true or false depending if current user 
 * target the given cities
 *
 * @param string/Array $city - Pass an array of cities , 
 * city name
 * @param string $city_region - Region name
 * @param string $exclude/Array -Pass an array of cities , 
 * or a single city 
 * @param  string $exclude_region - Region name
 *
 * @return bool
 */
geot_target_city( $city = '', $city_region = '', $exclude = '', $exclude_region  = '' );
 
// Usage
 
if ( geot_target_city(array( 'New York', 'Miami' )) ) {
    // show content
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kusty, 2015-11-15
@roman_tlt

For geolocation and geotargeting, you can use the free WT Geotargeting plugin . There is an extended paid version of WT Geotargeting Pro , with support for subdomains and WooCommerce, but many are limited to the free version and are satisfied.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question