Add field description in the listing form

Can someone please share the snippet to add a description to the “Billing Period (optional)” field in the listing form? I tried all these variations, but none of them worked. Thx

 
add_filter(
	'hivepress/v1/forms/listing_submit',
	function( $form ) {
		
		// Option 1: price_period
		if ( isset( $form['fields']['price_period'] ) ) {
			$form['fields']['price_period']['description'] = 'Select how often the price is charged';
		}
		
		// Option 2: billing_period
		if ( isset( $form['fields']['billing_period'] ) ) {
			$form['fields']['billing_period']['description'] = 'Select how often the price is charged';
		}
		
		// Option 3: _price_period (with underscore)
		if ( isset( $form['fields']['_price_period'] ) ) {
			$form['fields']['_price_period']['description'] = 'Select how often the price is charged';
		}
		
		// Option 4: period
		if ( isset( $form['fields']['period'] ) ) {
			$form['fields']['period']['description'] = 'Select how often the price is charged';
		}
		
		// Other fields...
		if ( isset( $form['fields']['title'] ) ) {
			$form['fields']['title']['description'] = 'Enter a descriptive title for your listing';
		}
		
		return $form;
	},
	1000
);

NVM. I figured it out with Inspect. found the right attribute - subscription_period

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		if ( isset( $attributes['subscription_period'] ) ) {
			$attributes['subscription_period']['edit_field']['description'] = 'Select how often the price is charged';
		}
		
		return $attributes;
	},
	1000
);Preformatted text
1 Like

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