Forums › Bug Reports › Restrict Autocomplete
Tagged: Foods Good For Liver
- This topic has 10 replies, 2 voices, and was last updated 3 years, 11 months ago by
Eyal Fitoussi.
-
AuthorPosts
-
March 26, 2016 at 8:19 am #51359
misiman
MemberI have found some instructions on how to limit Google Autocomplete results to just cities which is what I need to achieve:
http://rustamagasanov.com/blog/2014/09/04/google-places-limit-autocomplete-results-to-cities-only/
How/Where do I incorporate this into GeoMyWP?
Thanks
March 26, 2016 at 6:15 pm #51373Eyal Fitoussi
MemberHI,
with the current version of GEo my WP it is only possible by editing a core file. A better solution using A hook will be available in GEO my WP 3.0.If you are comfortable with editing a core file I can tell you which file to edit.
March 28, 2016 at 5:43 am #51378misiman
MemberHi,
I am very interested in getting this working – when is GeoMyWP v3.0 being released?
March 29, 2016 at 2:34 pm #51410Eyal Fitoussi
MemberI don’t have a release data for GEO my WP 3.0 yet. I would like to release the first beta by the end of next month, but I cannot promise since GEO my WP 3.0 is a major update and is mostly rewritten.
April 1, 2016 at 5:57 am #51473misiman
MemberOk,
I am happy to help test the beta version.
In the meantime, could you let me know where/what to edit in the core file.
Thanks
April 5, 2016 at 3:23 pm #51514Eyal Fitoussi
MemberSure,
1) Open the file:
geo-my-wp/assests/js/googleAddressAutocomplete.js
2) Line 13 which should be
1var options = {};is the line you need to modify based on the tutorial you posted above.
For example:12345var options = {language: 'en-GB',types: ['(cities)'],componentRestrictions: { country: "uk" }}3) Save the file and test it.
I will definitely need help testing the beta of GEO my WP 3.0. Once it is ready I will email subscribers and write a blog post about it. If you haven’t done so already you can subscribe for email on the home page of GEO my WP at the bottom.
Thanks,
April 24, 2016 at 10:17 pm #51852Eyal Fitoussi
MemberThis topic marked “Resolved” due to inactivity. If you wish to reply to this topic please change its status to “Not resolved” before replying.
June 23, 2016 at 8:28 am #52888misiman
MemberHi,
Is there a beta of GEO my WP version 3 yet?
Thanks
June 23, 2016 at 2:53 pm #52895Eyal Fitoussi
MemberThis reply has been marked as private.August 29, 2018 at 12:50 pm #57888Eyal Fitoussi
MemberAn update,
Since GEO my WP 3.x is now available you can use the script below to limit the address autocomplete results without modifying the core files. Just add the script to the functions.php file of your child theme.
12345678910111213141516171819function gmw_custom_modify_address_autocomplete_options() {?><script type="text/javascript">jQuery( document ).ready( function() {GMW.add_filter( 'gmw_address_autocomplete_options', function( options, field_id, input_field, GMW ) {// you can replace '(cities)' with other types.options.types = [ '(cities)' ];return options;}, 20, 4 );});</script><?php}add_action( 'wp_footer', 'gmw_custom_modify_address_autocomplete_options' );I hope this helps.
September 11, 2018 at 9:56 pm #57929Eyal Fitoussi
MemberThis topic marked “Resolved” due to inactivity. If you wish to reply to this topic please change its status to “Not resolved” before replying.
-
AuthorPosts
The topic ‘Restrict Autocomplete’ is closed to new replies.