How to hide part of an attribute value of a listing?

Hi,

I have an attribute of a listing that is confidential. I only want to show in the listing the first characters of the value.

For example, I have the attribute “secret_number” and user put the value “12345678”. I want to show in the listing “12345***”.

Can anyone help me to do it with a code snippet please ?

Thank you in advance and wish you a nice day !

Hi,

Please try to create a PHP snippet with hivepress/v1/fields/text/display_value hook, if you have an attribute of type text.
Also, If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources.

Hi, thank you very much for your answer ! I used this hook with a custom field type.

1 Like