Hello! I’m building a site for a client, and I need to create a WP block that renders a post field containing a raw email address as a clickable link. It would be used within loops and custom query blocks.
I’ve been able to create plugins that generate the clickable link on the frontend, but on the backend all of them look blank or invisible. If I put placeholder text in the link tag, that static text will render, but I would love for the editor preview to display the correct value of the post field.
I’ve tried using regular, dynamic and hybrid blocks, and none of them seem to produce a dynamic value on the editor screen.
I’m using Metabox.io for the custom fields, if that makes a difference.
Any thoughts?
Thanks!
Mike
Hey,
Did you create a wp theme with Pinegrow or a plugin? Did you include your stylesheets to the block editor? This is possible in Wordpress > Theme / Plugin settings
Hi, sorry for the long delay in response!
It’s saved as a Pinegrow WP plugin. I’ve used both the desktop editor and the WP Plugin to create it.
Stylesheets shouldn’t make a difference, I don’t think. It isn’t that the content is there an set to “display: none.” The tag is there and redners on the editor screen, but the custom field doesn’t load.
It doesn’t seem to matter if I’m using built-in Pinegrow post field setting or the metabox.io function to get the field. The field renders fine on the front end, but the tag is empty on the back end.
Specifically, the block I’ve created, which is saved as a plugin, takes an email address field and renders it as a link.
On the backend it outputs <a target="_blank" href="mailto:"></a>
and on the frontend it outputs <a target="_blank" href="mailto:some@email.com">some@email.com</a>
.
It’s being used inside a custom query loop, but other elements inside that loop, including the built-in “attribute” function of the paragraph Gutenberg Block all work fine.
Also, FWIW, I tried exporting it as React, Dynamic PHP and Hybrid, and none of those settings fixes it… I think it has to do with the query loop, but I’m not 100% sure.
Anyone have any insights?