How can I modify text for Price field when creating a new listing

How can I change the text for the “Price” field to “Price per hour” when adding a new listing? I Tried Loco Translate and changed the word Price to Price per hour but it does not change on the create listing page.

Thanks,
Tom

I used the below code snippet to change price per hour on the listing picture.

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

		return $fields;
	},
	1000,
	2
);

But now I want to hide it here in the below screenshot and say $200.00 Total:

I figured out the first question with Loco Translate. But I don’t know how to do the above Total: $200.00

Please try this PHP snippet

add_filter(
	'hivepress/v1/models/listing/fields',
	function( $fields, $model ) {
		if(isset( $fields['price'] )){
			if ( !hivepress()->helper->is_rest() ) {
				$fields['price']['display_template'] = '%value% / Hour';
			}else{
				$fields['price']['display_template'] = 'Total: %value%';
			}	
		}

		return $fields;
	},
	1000,
	2
);

Yevhen,

You are outstanding! This worked perfectly we can’t thank you and Ihor enough for all your hard work and help! Greatly appreciated once again!

Thanks,
Tom

1 Like

Thanks! If you have a minute, please rate it on the WordPress repository [HivePress - Multipurpose Directory, Listing & Classifieds WordPress Plugin] Reviews | WordPress.org Any feedback is appreciated.

I tried the snippet, it changed ‘Price’ to ‘Price / Hour’ on All Service list page and each Service detail page. But it didn’t change ‘Price’ to ‘Price / Hour’ on ‘List a Service’ Page. How can we change it on ‘List a Service’ page?
By the way, I have deleted ‘Hourly Rate’ attribute from both ‘Listings’ and ‘Vendors’

Thanks.

Please try this PHP snippet

add_filter(
	'hivepress/v1/forms/listing_update',
	function($form){
		if(isset($form['fields']['price'])){
			$form['fields']['price']['label'] = 'Price / Hour';
		}
		return $form;
	},
	1000
);