• 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.

    ihordeveloper

    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!

    ihordeveloper

    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 ?

    ihordeveloper

    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)

You must be logged in to reply to this topic.

Subscribe

Sign In

Don't have an account? Register

Forgot password?

Register

Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.