1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[WP]How to change front page thumbnail URL by detect traffic countries

Discussion in 'Programming' started by wkcalvin, May 18, 2017.

  1. wkcalvin

    wkcalvin Regular Member

    Joined:
    Aug 15, 2012
    Messages:
    210
    Likes Received:
    63
    Occupation:
    Professional Scammer
    Location:
    Asia
    Home Page:
    I searched a lot, no hints or sample code can completely do this

    Any one can help?
     
  2. slighty

    slighty Newbie

    Joined:
    Jul 31, 2017
    Messages:
    35
    Likes Received:
    9
    I don't think this is possible, but then again I could be wrong.
     
  3. abraguda

    abraguda Newbie

    Joined:
    Apr 4, 2013
    Messages:
    44
    Likes Received:
    13
    Gender:
    Male
    Could you explain more or tell me the link of your page so that I could look better at what you want to achieve? I believe it might be possible depending on which thumbnail you want to change. First thing is to detect where did the person came from - it's kind of easy to detect and you need a good updated library of IP's <-> countries mapping. The second thing is custom code for thumbnail change - depending on the situation you can include it in WP's theme files directly or create module with shortcode and use it in posts for example.

    One concern though - if you are using advanced caching, this might be the problem (as with everything dynamic on cached pages). So if it is the only one page where you want to achieve this, you could leave that page uncached for example. The second solution is to cache the page PER EACH country, but this means that your country detector must detect country first and then lead to the cached country page. I believe countries can be detected on the server side too, not just on PHP code. The third option is to load image via AJAX call.