Hello, could you please help check if the code you provided is still effective ? https://toolset.com/documentation/user-guides/how-to-use-toolset-maps-plugin-in-china/
a few months ago I had tested with this piece of code, it works in China, but the address suggestion doesn't work out of China, now I found if I added this piece of code, the maps will not be loaded, even in China, it was not working as well. could you please help me check if something went wrong? or something about "你懂得"。 Thank you so much!
Dear Jeffrey,
Please setup those http URLs in the custom codes as HTTPS protocol URLs, for example, modify your PHP codes as below:
add_filter( 'toolset_filter_toolset_maps_api_js_url', 'prefix_serve_maps_js_from_china' );
function prefix_serve_maps_js_from_china( $url ) {
$url = '<em><u>hidden link</u></em>';
return $url;
}
add_filter( 'toolset_filter_toolset_maps_api_geocode_url', 'prefix_serve_maps_geocode_from_china' );
function prefix_serve_maps_geocode_from_china( $url ) {
$url = '<em><u>hidden link</u></em>';
return $url;
}
And test again.
More help:
https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/#displaying-current-visitor-location
For this feature to work, your site needs to use the secure, HTTPS protocol. This is because all modern browsers require secure connection for getting the visitor’s location.
Thank you so much! done! 🙂
Sorry, it might still get issues, my friend told me there is only a picture shown, street view doesn’t work, the pages with google map can be displayed, but the maps can not be loaded. Address autocomplete is not working so far? Or still blocked? I used that code you offered , the page can be displayed, but map is not shown up yet. You can go to my site to check, thanks
Please provide your website credentials in below private detail box, also point out the problem page URL, describe detail steps to duplicate the same problem:
1) the maps can not be loaded
2) Address autocomplete is not working so far?
3) Or still blocked?
I need to test and debug it in a live website, thanks
The credentials you provided is not valid, I get this error message:
ERROR: Invalid username
Please check it, make sure it is an valid admin account, you can update it here:
https://toolset.com/forums/topic/adding-the-code-you-provided-to-umake-google-map-work-in-china-is-it-still-taki/#post-627093
In case it is a compatibility problem, please deactivate other plugins and switch to wordpress default theme, and test again.
Since I am in China, I have tested the URL you mentioned above, I can see some JS errors in the Chrome browser window when click the button "Use my location", it seems that it is still loading JS files from hidden link, which are blocked in China, see screenshot: map4.JPG
Please point out where I can edit your PHP codes too.
Hi Luo, Thank you so much for the reply, I have updated the credential code already, you can see the code updated in private box. this link is snippet, you can edit the code here, hidden link. if something broke my site, you just go to activate the safe mode by adding
define('CODE_SNIPPETS_SAFE_MODE', true);
to wp-config.php. maybe you can also deactivate the Rocket Cache because I have set the Js defer. I don't know if this figuration was associated with the JS error. Thank you so much for your help!
I have tried the username/password you provide in the private message box:
https://toolset.com/forums/topic/adding-the-code-you-provided-to-umake-google-map-work-in-china-is-it-still-taki/#post-627093
same error:
ERROR: Invalid username.
see screenshot login.JPG, please make sure it is valid to login your website
I assume you are using code-snippets plugin to setup those custom PHP codes, it might conduct unexpected compatibility problem, please try to move those PHP codes into your theme/functions.php and test again.
I am so sorry, that's my fault. I have tested with every username and password. you can access my site now. Thank you so much!
Thanks for the details, I have tried to trace the problem to file in google.cn:
hidden link
They are still using API from: google.com, googleapis.com, gstatic.com
Which are blocked in China main land:
For example, you can see those codes in above URL:
hidden link\u0026hl=zh-CN\u0026gl=CN\u0026
hidden link\u0026gl=CN\u0026
So I tried it in of google.cn maps directly, for example:
hidden link
I get same problem, see screenshot google-cn2.JPG, lots 404 errors and time-out errors.
So the problem should exists in the google side, I don't think we can fix in the Toolset side. It does not work in google official website (google.cn), so it won't work in your website too.
For your reference
.... umm, I waive the bigger map in the archive page, still keep a sign, and then put the map into a lightbox for some users who are out of China. OK , Thank you so much!
one more thing, if I put the map into a lightbox, will it load page first, and only when users click the lightbox, will the map be loaded? otherwise, I am afraid the pages cannot be loaded in China mainland. vice verse, if adding that code will strongly slow down my site. the pages will even not be loaded.
For the new question:
when users click the lightbox, will the map be loaded?
It should be able to loaded, but in my opinion, there is a simple workaround, you can get the visitor IP address, so you can know which country are they from, then check the country value, then display the google map or not, I tested it in your website, with these steps:
1) Install plugin "GeoIP Detection"
2) Dashboard-> Toolset-> Front-end Content
option "Third-party shortcode arguments", fill the shortcode name "geoip_detect2"
hidden link
3) Use Views shortcode [wpv-conditional] to check the country value, then display what you want, see the example page in your website:
hidden link:
Your country is: [geoip_detect2 property="country"]
<hr />
[wpv-conditional if="'[geoip_detect2 property="country"]' = 'CHINA'" evaluate="false"]
Here display the google map
[/wpv-conditional]
[wpv-conditional if="'[geoip_detect2 property="country"]' = 'CHINA'" ]
You are in [geoip_detect2 property="country"], Don't display the google map!
[/wpv-conditional]
And test it in front-end by a visitor from China mainland, see screenshot google-map1.JPG
I really really thank you so much for the help, it will help my site works in China without loading slow. everything works fine except google map doesn't work in China. 🙂