Join our new community forum for support & discussion

Join Now

Home Support Extensions Geolocation List city

List city

  • Author
    Posts
  • jon

    Instead of using google maps, use city list as a link. must make the city choose when the ad is inserted.

    it’s possible?

    Thanks.

    ihor developer

    You can try using a custom selectable attribute instead of Google Maps, add a new attribute in HivePress/Listings/Attributes section (with “Select” type), and add cities manually. Make it required so users will have to select some city from the list. Please note that it’s just an attribute and cities will not be displayed on a map, and it will not define location (although you can add it to the search form).

    jon

    how can I add it in the search form? in the search bar instead of google maps

    Thanks!

    ihor developer

    If this attribute is named city then this code snippet should work:

    add_filter(
    	'hivepress/v1/models/listing/attributes',
    	function( $attributes ) {
    		if ( isset( $attributes['city'] ) ) {
    			$attributes['city']['searchable'] = true;
    		}
    
    		return $attributes;
    	},
    	1000
    );
    unitehearts

    @jon – can you share the list of cities of the world that you are using ?

    i am looking for a fully comprehensive list of all towns, cities etc of the world – can anyone help ?

    ihor developer

    I strongly suggest using an external API (Google Maps) instead, flooding the WordPress database with geodata may significantly slow down your site.

Viewing 6 posts - 1 through 6 (of 6 total)

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.