I’m using the RentalHive theme with the Geolocation and Social Links extensions.
Is it possible to change the listing_update
form attribute descriptions depending on the category?
For example…
Category A would have a description for the Title attribute.
Category B would have a different description for the Title attribute.
I have 2 categories:
- For Sale (category 44)
- Rentals (category 45)
These are hard-coded attributes such as Images, Title and Description as well as geolocation and social links fields such as Location, Website, and Instagram. These attributes are not managed by WP Admin under the Listing attributes so you cannot use WP Admin to set the field descriptions.
So I am using this code in my functions.php
file to set these field descriptions:
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
if ( isset( $form['fields']['title'] ) ) {
$form['fields']['title']['description'] = 'Title description goes here.';
}
return $form;
},
1000
);