• Resolved yhdm

    (@yellowhousedesign)


    Are there conditionals available to check if geo information exists? For example:

    if (condition) {
         echo 'your postal code is ';
         echo do_shortcode( '[postalcode]' );
    }

    I’ve noticed that when I’m in network at my office, the postal code does not show up. I would like to avoid showing:

    your postal code is

    https://www.ads-software.com/plugins/wpengine-geoip/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Taylor McCaslin

    (@taylor4484)

    Hi yellowhousedesign,

    There are some cases where GeoIP can’t identify the GeoData for specific locations. We are working to improve the accuracy of GeoIP.

    While we don’t have conditional helper functions (though I will take that feedback back to our development team), it would be easy to do this via PHP referencing the PHP environment variables that GeoIP adds, it’d look something like this:

    Available GeoIp Environment Variables:

    getenv( 'HTTP_GEOIP_COUNTRY_CODE' )
    getenv( 'HTTP_GEOIP_COUNTRY_NAME' )
    getenv( 'HTTP_GEOIP_LATITUDE' )
    getenv( 'HTTP_GEOIP_LONGITUDE' )
    getenv( 'HTTP_GEOIP_AREA_CODE' )
    getenv( 'HTTP_GEOIP_REGION' )
    getenv( 'HTTP_GEOIP_CITY' )
    getenv( 'HTTP_GEOIP_POSTAL_CODE' )

    Conditional:

    if ( isset( 'HTTP_GEOIP_POSTAL_CODE' ) ) {
         echo 'your postal code is ';
         echo do_shortcode( '[postalcode]' );
    }

    Thread Starter yhdm

    (@yellowhousedesign)

    Perfect – thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘conditionals?’ is closed to new replies.