How to display attribute text/value in a shortcode of another Wordpress plugin? (want to protect text, URL from crawlers bots)

Hello,

I have already installed a Wordpress (6.9.4) plugin Email Encoder – Protect Email Addresses and Phone Numbers – WordPress plugin | WordPress.org to protect email addresses and they says at Email Encoder – Protect Email Addresses and Phone Numbers – WordPress plugin | WordPress.org :slight_smile:

How do I encode phone numbers or other text?

Just use the following shortcode within your posts:
[eeb_protect_content]35-01235-468113[/eeb_protect_content]

For other parts of your site you can use the template function eeb_protect_content().

My up to date HivePress 1.7.23 has 2 Listings > Attributes , which i would like to also protect (from crawlers and less clever bots):

attributea = text containing special characters

attributeb = URL which is currently displayed as clickable hyperlink on the front-end (ListingHive free theme)

attributea, attributeb is a Field name” set in attribute settings.

HivePress AI Assistant suggested following content of a “Format” field (one of the fields in the Display area of a Attribute settings page Listings/Attribute/Attribute name, scroll down) field:

[eeb_protect_content]%value%[/eeb_protect_content]

or

[eeb_protect_content]<a href="%value%">%value%</a>[/eeb_protect_content]

on the site it appears either as a text or a hyperlink, but source code of the listing page does not contain such text, instead there is a script which is handling the coding of that content. So the protection works on the background.

AI also suggest a button to copy to the clipboard. In a Attribute settings, add into the “Format” field:

[eeb_protect_content]<a href="%value%" target="_blank">%value%</a>[/eeb_protect_content]
<button onclick="navigator.clipboard.writeText('%value%'); alert('Copied!');" style="margin-left:10px;">Copy</button>

but HivePress processes that erroneously upon saving the page, resulting in:

[eeb_protect_content]<a href="%value%" target="_blank">%value%</a>[/eeb_protect_content]
<button style="margin-left:10px">Copy</button>

I have submit this issue to Format field in Attribute settings silently truncate the input . Any idea on a workaround?

Hi,

If the shortcode is correct, then this is the recommended way:

[eeb_protect_content]%value%[/eeb_protect_content]

This Display Format for the attribute should wrap the field value with the HTML tags or scripts added by this third-party plugin, so it wraps and protects the value. If you need extra custom HTML or scripts for custom logic, I recommend creating a custom template part for this attribute or injecting it into the listing_view_page template directly, via the hivepress/v1/templates/listing_view_page hook – you can find some examples here Search results for 'hivepress/v1/templates/listing_view_page merge_blocks order:latest' - HivePress Community

Hope this helps