How to make an exception for one field? I don't want a thousands separator for it

I have created an attribute (year) and I need a php snippet that removes the thousands separator for this attribute. Now the front-end shows 2 023 and I need the number to be 2023. without gaps

My second question is the opposite: I created a Phone attribute on the seller. And there I need to display a space separator. Because on the website the phone shows as +420123456789 and I need a gaps +420 123 456 789

  1. Please send more details that may help to detect or reproduce this issue (e.g., attribute settings, screenshots).

  2. Please try this PHP code snippet

add_filter(
	'hivepress/v1/fields/phone/display_value',
	function($value){
		return preg_replace('/(\d{3})(\d{3})(\d{3})(\d{3})/', '$1 $2 $3 $4', $value);
	},
	1000
);

You’ve done a man’s job, sir. Phone separator is ready.
For number type “Year field” I created “run_date” name Attribute. it is displayed in block (secondary) page (secondary)
I dont want display year like this 2 023.
I want this: 2023. Without Gaps.

it is displayed in block (secondary) page (secondary)

Please try this PHP code snippet

add_filter(
	'hivepress/v1/fields/number/display_value',
	function($value, $field){
		if ( 'run_date' !== $field->get_name() ) {
			return $value;
		}

		return $field->get_value();
	},
	1000,
	2
);
1 Like

Hello and snippet for thousand separator in sidebar - price range?
hgghj

Hi,

Sorry, there’s no simple code snippet for this, it would require a custom implementation. If customizations beyond the available features are required for your site, please consider hiring someone for custom work Fiverr - Freelance Services Marketplace

i I am writing to Mr. yevhen… not to you.
Your only job here is to repeat the same sentence over and over like a robot. Don’t post in my topic if you don’t know the answer.

Hi,

Please note that we can provide simple PHP snippets; all further customization is beyond the scope of our support: Support Policy | HivePress.

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