• Hi there,

    We have tried the plugin on our live site and it does nor work, so I created this test environment and installed the plugin. when I try test lookup it shows my IP and the debug info seems all fine.

    Here is the shortcode I am using…
    [geoip_detect2_show_if country=”CA”] TEXT [/geoip_detect2_show_if]
    [geoip_detect2_countries_select name=”mycountry” lang=”fr”]

    They both show nothing on the page…I laos tried changing settings using ajax, no luck, tried adding CSS classes, that does not seem to work either…not sure if I am doing something wrong or not? I am adding the shortcodes to the page via the shortcode block.

    Here are the settings…https://postimg.cc/xNrxDDg8

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Benjamin Pick

    (@benjamin4)

    You need to add the option “Resolve shortcodes via AJAX”

    Thread Starter Primitiv Media

    (@nicolasmontigny)

    Hi there,

    As mentioned above I tried pretty much all settings including AJAX. To confirm I have just tried using ajax to resolve shortcodes and add classes, it does not work period. Same thing with adding classes without using ajax, no errors no nothing.

    we are using:

    HostIP.info Web-API

    Add a country-specific CSS class to the <body>-Tag on every page.
     Disable caching a page that contains a shortcode or API call to geo-dependent functions.
    At least WP SuperCache, W3TotalCache and ZenCache are supported.
     Enable AJAX endpoint to get the information for the current IP even on cached pages.
    
     Add JS Helper functions to all pages.
    This enables you code geo-dependent behavior in JS (see documentation)
     Add a country-specific CSS class to the <body>-Tag (via AJAX).
    This requires the JS Helper functions, either by ticking the option above, or by enqueuing it manually for the sites that need it.
    Resolve shortcodes (via AJAX).
    (JS Helper functions are added automatically for pages that contain ajax shortcodes.)

    ALL OF THESE ARE ON, when I test using test lookup it shows my IP and all info. Can we get more assistance, please?

    Thanks!

    Plugin Author Benjamin Pick

    (@benjamin4)

    Are there JS execution errors (check in the development console)? – If yes, please copy them here. If no:

    In the HTML, do you find the class “js-geoip-detect-show-if” ? – If no, the shortcodes are not evaluated server-side.
    If yes, change the shortcode to :

    [geoip_detect2_show_if country=”CA”] TEXT [else] ELSE [/geoip_detect2_show_if]

    to check if the “else” condition is triggered.

    Thread Starter Primitiv Media

    (@nicolasmontigny)

    There are no console errors, it simply says get_info.js:45 Geolocation IP Detection: Using cached response but this is not an error.

    I do indeed see the class js-geoip-detect-show-if see below:

    I replaced the shortcode with [geoip_detect2_show_if country=”CA”] TEXT [else] ELSE [/geoip_detect2_show_if] as instructed and all I see is the word ELSE nothing else appears…

    <div class="itemBody kl-blog-page-body">
    		<!-- Blog Image -->
    				<!-- Blog Content -->
    		
    
    <span class="js-geoip-detect-show-if geoip-hidden" style="display: none;" data-options="{&quot;skip_cache&quot;:false,&quot;lang&quot;:[&quot;en&quot;,&quot;en&quot;],&quot;default&quot;:&quot;&quot;,&quot;parsed&quot;:{&quot;op&quot;:&quot;and&quot;,&quot;not&quot;:0,&quot;conditions&quot;:[{&quot;p&quot;:&quot;country&quot;,&quot;v&quot;:&quot;\u201dca\u201d&quot;}]}}"> TEXT </span><span class="js-geoip-detect-show-if geoip-shown" style="" data-options="{&quot;skip_cache&quot;:false,&quot;lang&quot;:[&quot;en&quot;,&quot;en&quot;],&quot;default&quot;:&quot;&quot;,&quot;parsed&quot;:{&quot;op&quot;:&quot;and&quot;,&quot;not&quot;:1,&quot;conditions&quot;:[{&quot;p&quot;:&quot;country&quot;,&quot;v&quot;:&quot;\u201dca\u201d&quot;}]}}"> ELSE </span>

    Hopefully we can resolve this soon!

    Plugin Author Benjamin Pick

    (@benjamin4)

    Ok then the shortcode works, but probably it does not detect “CA” correctly.
    Can you add this please:

    Detected country: [geoip_detect2 property=”country.isoCode”]

    Thread Starter Primitiv Media

    (@nicolasmontigny)

    Hi there,

    I added this shortcode alone
    [geoip_detect2 property=”country.isoCode”]
    and tried doing this [geoip_detect2_show_if country=”CA” property=”country.isoCode”] TEXT [/geoip_detect2_show_if] currently both are on the page….

    This is what I get in the HTML…still does not show anything….

    <div class="itemBody kl-blog-page-body">
    		<!-- Blog Image -->
    				<!-- Blog Content -->
    		<span class="js-geoip-detect-shortcode" data-options="{&quot;skip_cache&quot;:false,&quot;lang&quot;:[&quot;en&quot;,&quot;en&quot;],&quot;default&quot;:&quot;&quot;,&quot;property&quot;:&quot;country.isoCode&quot;}"></span>
    
    <span class="js-geoip-detect-show-if geoip-hidden" style="display: none;" data-options="{&quot;skip_cache&quot;:false,&quot;lang&quot;:[&quot;en&quot;,&quot;en&quot;],&quot;default&quot;:&quot;&quot;,&quot;property&quot;:&quot;country.isoCode&quot;,&quot;parsed&quot;:{&quot;op&quot;:&quot;and&quot;,&quot;not&quot;:0,&quot;conditions&quot;:[{&quot;p&quot;:&quot;country&quot;,&quot;v&quot;:&quot;\u201dca\u201d&quot;}]}}"> TEXT  </span><span class="js-geoip-detect-show-if geoip-shown" style="" data-options="{&quot;skip_cache&quot;:false,&quot;lang&quot;:[&quot;en&quot;,&quot;en&quot;],&quot;default&quot;:&quot;&quot;,&quot;property&quot;:&quot;country.isoCode&quot;,&quot;parsed&quot;:{&quot;op&quot;:&quot;and&quot;,&quot;not&quot;:1,&quot;conditions&quot;:[{&quot;p&quot;:&quot;country&quot;,&quot;v&quot;:&quot;\u201dca\u201d&quot;}]}}"></span>
    
    <p></p>
    	</div>
    Plugin Author Benjamin Pick

    (@benjamin4)

    1. Try this shortcode: [geoip_detect2_user_info] Is the IP correct?

    2. Try calling the site in the private mode of the browser. (Because AJAX mode caches the looked up data for 1 week by default, private mode looks it up again.)

    Thread Starter Primitiv Media

    (@nicolasmontigny)

    Hi there,

    This is what I get in both incognito and regular chrome browser. The IP is fine.

    IP of the user: 107.XXX.13.XXX

    Data from: HostIP.info Web-API

    What could the issue be?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Shortcode Showing Nothing’ is closed to new replies.