Skip to content

Instantly share code, notes, and snippets.

@hivepress
Last active April 11, 2023 20:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hivepress/9867bf3676a74317014cdddfd2e83c4b to your computer and use it in GitHub Desktop.
Save hivepress/9867bf3676a74317014cdddfd2e83c4b to your computer and use it in GitHub Desktop.
Change the Location field placeholder in the listing search form #hivepress #geolocation
<?php
add_filter(
'hivepress/v1/forms/listing_search',
function( $form ) {
if ( isset( $form['fields']['location'] ) ) {
$form['fields']['location']['placeholder'] = 'custom text here';
}
return $form;
},
1000
);
@deszigeorge
Copy link

Thank you for this. Is there a way I can make the location field a drop down menu just like the way "all categories" shows a drop down?
Screenshot 2023-04-11 124426

@hivepress
Copy link
Author

Yes, but instead of Geolocation you'd have to use a manually created Select attribute. Please note that Geolocation also adds useful features like radius-based search.

@deszigeorge
Copy link

Okay, thank you for your prompt response.
I have created the custom attribute, how do I add it to the search bar?

@hivepress
Copy link
Author

Please try using our forum if there are any other issues https://community.hivepress.io/ Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment