geo

[insert_php]
if ( do_shortcode(‘[wpgc_city]’) === “Gizeh” )
{ echo”Hello Ahmed” ;
echo do_shortcode(‘[insert page=”179″ display=”all”]’);}
else
{echo “Hello Marwa”; }

[/insert_php]
[wpgc_ip] – IP Address of the reader
[wpgc_city] – City of the reader
[wpgc_state_name] – State name of the reader
[wpgc_state_code] – Two letter State code of the reader
[wpgc_postal_code] – Five digit Postal code of the reader (eg: ~)
[wpgc_country_name] – Country name of the reader
[wpgc_country_code] – Two letter Country code of the reader
[wpgc_latitude] – Latitude of the reader
[wpgc_longitude] – Latitude of the reader
Conditional Shortcodes – Only available in the body of the post
Use these shortcodes to display customized content in your blog posts to readers

[wpgc_is_city_and_state city=”Yardley” state_code=”PA”]
[wpgc_is_ip ip=”xx.xx.xx.xx”]
[wpgc_is_not_ip ip=”xx.xx.xx.xx”]
[wpgc_is_city city=””]
[wpgc_is_not_city” city=””]
[wpgc_is_nearby”] – Uses the value you specify in the Nearby Range setting from the administrative panel
[wpgc_is_not_nearby”]
[wpgc_is_within miles=”10″]
[wpgc_is_within kilometers=”12″]
[wpgc_is_country_name country_name=””]
[wpgc_is_country_code country_code=””]
[wpgc_is_state_name state_name=””]
[wpgc_is_state_code state_code=””]
[wpgc_is_not_country_name country_name=””]
[wpgc_is_not_country_code country_code=””]
[wpgc_is_not_state_name state_name=””]
[wpgc_is_not_state_code state_code=””]

Examples

[wpgc_is_nearby] Hi Neighbor! [/wpgc_is_nearby] – Will display “Hi Neighbor!” to readers within a configurable distance from your home base.
[wpgc_is_within miles=10] Stop on over, since you’re in the area.[/wpgc_is_within] – Will display “Come on over!” in the post body if the user is viewing the post from within 10 miles.
[wpgc_is_ip ip=123.123.123.123] I used to own this IP Address [/wpgc_is_ip] – Will display the message only if the user has that specific IP Address.
[wpgc_is_city city=”Yardley”] Hello Fellow Yardlian [/wpgc_is_city] – Will display the message only if the user has that specific IP Address.

More Examples

There are several pages on this blog that incorporate examples of WPGeocode:

20 Comments

  1. Talha

    This is a great plugin. I just wished that it would have an option to get the location of not only the reader but the post author as well and lock that in the post. That way you can only show that post to the people in that city or state. I’m working on a dating site and this would make everything so easy because right now I have to ask the profile owners to enter their location and also ask viewer to filter the location that they want to see posts from.

  2. Nathan

    Just wanted to stop by and thank you for making a great plugin. This has tremendously saved me time, and I want to say thanks for doing such a fine job with it.

  3. Alistair

    This looks like the plugin I need, although I am based in the UK is there a way to make it work for the UK or are you planning a UK release? regards Alistair

  4. Bernard

    Hi. Thanks for the nice plugin. Looks though as if it only works for USA am I correct? When I run it for my locality which is Johannesburg, South Africa it does not show anything but when I run it through HideMyAss proxy for Chicago it works like a charm. Please let me know, thanks.

  5. Is there a way to configure the [wpgc_is_city city=””] shortcode so that it will cover a radius behind the city that is listed. For example, if I set [wpgc_is_city city=”Philadelphia”] is there a way to include areas in a ten miles radius around it?

    • John,

      No – unfortunately the city shortcodes don’t work on a radius. There is, however the is_near shortcode that provides similar functionality… you need to configure a home latitude/longitude in the wpgc options panel… hope this helps.

      Mike

  6. Mark

    Great plugin. I have a question. I do promote cpa offers. I have a landing page (full width) designed for US traffic.
    When a user enters the LP and it’s not in the US, is it possible to redirect to another LP on the same website with a different offer for that country?
    Best regards

  7. Great Plugin.

    I did a lot of searching for free and paid plugins to use on my site for GEO location based content serving. This works really well for me as I use Amazon associates and I can filter templates to serve relevant country product details and pricing.

    However, the BIG PROBLEM I have at the moment is that my site has the latest WordPress 3.8 installed and this GEO plugin messes up my posts screen screen, it seems to mess up the jquery code for showing many of my other accordion menus in post screen.

    The front end works brilliantly but the back end/admin needs the author to do some css or jquery mods to make it compatible with WP3.8

    You can see this in action on my site @ this page: http://www.getreview.org/matricom-mx2-matricom-g-box-midnight-mx2-dual-core-xbmc-android-4-2/

    Keep up the great work.

    Julie (UK)

  8. Ooops, almost forgot to mention that if you want an intermediate fix to the WP3.8 post edit problem then you can configure wp-geocode from the settings menu.

    Edit the file => http://www.yoursite.com/wp-content/plugins/wpgeocode/wpgeocode.php

    Comment out (Line 18 – wpgeocode.php):

    before:
    add_action(‘admin_menu’, ‘wpgc_add_options_page’);

    after:
    // add_action(‘admin_menu’, ‘wpgc_add_options_page’);

    FTP the file back to the server, or even edit the file in the plugin editor in wordpress.

    This fix solves the problem but once you make the change then you can’t see the admin wpgeocode settings – but I guess you can un-comment the change to make any settings changes and then re-comment the line 18 as above.

    Hope this helps.

    Julie (UK)

    • Julie – thanks for taking the time to let me know about this error. I’ve located what I believe to be the cause of the error… it’s a namespace issue. I’m using a toggleVisibility javascript function that appears to be in use elsewhere. I’ll be updating the plugin on wordpress.org/extend/plugins shortly.

      thanks again!

  9. Hi, your solution for Geo Coding may work perfectly for what I am trying to do. I have a single page site design that has 100 plus city locations where services are offered. What I want to be able to do is have one page that comes up in the search engines in the city where the person is located. If the city matches one where services are offered then the site will show up in Google, Yahoo and Bing along with local business directories.

    Can this be achieved with this solution? Does a location page need to be made for each city or can this be done just through the database association?

    I look forward to hearing back from you. Thank you.

  10. LOVE this plug in. I am sure I read somewhere that you have set up the code so that if I wanted to get the paid database, it would work. I need the accuracy of the GeoIP2 city database. Can you tell me if this will work?

    thanks,

    Victor

    • I’m also interested in this. Or, is there a way to add an IP or range of IPs to the existing database? It seems to work fine for the most part, but not for a colleague of mine, so at the very least I’d like to ensure his IP is in the DB. I’m new to this and not totally sure how it works, (ie: does the plugin create a local DB of all the countries/codes, or does it reference a live MaxMind one?). Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *