How to add Examples to Attributes

  1. How would I be able to add Example text to an attribute that people can see when making a listing? For example how the ‘optional’ text shows beside the attribute in light grey text. Another example would be for the location attribute to put ‘City, State’ in grey text?
  2. How can I make the location from the geolocation an attribute that users can filter by, and not just with the search bar?

Hi,

  1. If it’s a custom attribute, please set the Placeholder for it. If it’s a built-in attribute like Location, you can try changing its placeholder via Loco Translate or a code snippet like this one Change the Location field placeholder in the listing search form #hivepress #geolocation · GitHub

  2. If you enable Regions then the Location field works for both the radius-based search and filtering, e.g. if someone types a city then it’ll work like selecting a city from the drop-down and filtering, if there’s an exact address then the radius-search will be performed.

That code snippet changes the placeholder text for the search bar but not the text for the attribute in the create a listing page.

I am looking to add text that only the host will see when making a listing. Exactly how the ‘optional’ text shows in light grey font when making a listing, but I would like to give example text to guide the host into what needs to be inserted in the specific field.

Please try using this one instead:

add_filter(
	'hivepress/v1/forms/listing_update',
	function( $form ) {
		if ( isset( $form['fields']['location'] ) ) {
			$form['fields']['location']['description'] = 'custom text here';
		}

		return $form;
	},
	1000
);

Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.