M
M
Maxim Lesnikov2016-02-13 14:17:41
Geolocation
Maxim Lesnikov, 2016-02-13 14:17:41

How to display news depending on the city of the site visitor?

Good afternoon everyone. Interested in this question.
I am developing a wedding website where photographers, videographers, etc. post profiles about themselves, and newlyweds can choose them.
The question arose of how to make sure that when a person enters the site, exactly those business cards (for example, photographers) that are in his city are shown.
How to implement it? not to make many subdomains.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
redakoc, 2016-02-13
@redakoc

Fully automatic - nothing. Generally.
Here now they will write about geoip, but this has not been the case for a long time. And since the moment when the mobile Internet in particular has become the norm.
On IP the hope is weak. Right now I'm sitting at one end of the country, and whois defines me as if I'm sitting at the other end of the country. At my mobile operator, half of the subscribers have Moscow IPs, and the other half have St. Petersburg IPs. Although it provides services throughout the country.
Querying the city and remembering is the most reliable.

I
Igor Vorotnev, 2016-02-14
@HeadOnFire

1. Create a custom taxonomy "city" and fill in the city terms.
2. Assign these city terms to your content.
3. Determine the city automatically, as redakoc says, it is very, very unreliable, therefore, although automatic detection is necessary, it is better to add a drop-down list with all city terms and, when the user selects, save the data in a cookie.
4. To determine the automatic one, it is not necessary to use GeoIP, there is also a variant with the GeoLocation API.
HTML5 GeoLocation API
Google Maps API
Googling more on this topic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question