Add icon and text to price attribute

Hi,

Is it possible to add an icon and text to the price attribute that the bookings/marketplace plugins create by default?

Only listings that belong to the ‘Self-funded’ category show a price tag, and I would like to add an icon and the word ‘Self-funded’ to the left of the price tag - similar to the picture below, where the ‘Work-exchange’ category shows an icon and text.

Hi,
Please try this PHP snippet:

add_filter(
	'hivepress/v1/models/listing/fields',
	function( $fields, $model ) {
		if ( isset( $fields['price'] ) ) {
			$fields['price']['display_template'] = '$%value% / custom text here';
		}

		return $fields;
	},
	1000,
	2
);
1 Like

Thanks, I’ve modified your snippet a bit and managed to add text above the default price attribute, but I can’t figure out how to add an icon before the text. Is it possible to do that via the snippet or custom CSS?

Hi,
Please try this PHP snippet:

add_filter(
	'hivepress/v1/models/listing/fields',
	function( $fields, $model ) {
		if ( isset( $fields['price'] ) ) {
			$fields['price']['display_template'] = '<i class="hp-icon fas fa-user"></i> %value% / custom text here';
		}

		return $fields;
	},
	1000,
	2
);

Thanks. That did the trick!

Hi I think i have more or less the same issue here:
image
I need the paragraph to start on the next line as well.

Screen Location is a attribute in Listings

Hi,
Please try this PHP snippet:

add_filter(
	'hivepress/v1/models/listing/fields',
	function( $fields, $model ) {
		if ( isset( $fields['price'] ) ) {
			$fields['price']['display_template'] = '<i class="hp-icon fas fa-user"></i> %value%/custom text here <p>custom paragrath text here</p><p>custom paragrath text here</p> ';
		}

		return $fields;
	},
	1000,
	2
);

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