Hi Stephanie
This looks like a relationship field, which we don’t support out the box with our Custom Field
element.
However, you can use ACF shortcodes, in our Text
block, to display this field correctly.
Do let me know if that is a viable alternative for you (and that it works!)?
Best
-
This reply was modified 2 years, 5 months ago by Code Amp.
Thanks for your reply! I’ve tried using the ACF shortcode as suggested, but it doesn’t return anything on the back end, and when I update it and view the result on the front end, it shows that WordPress has experienced a critical error (images attached).
ACF Shortcode on Backend
Critical Error
Hi Stephanie
That’s a shame, we’ve tested with other ACF shortcodes and everything seemed to work ok :/
What would be useful is to find out what the exact error is.
Would you be able to enable WP_DEBUG
and WP_DEBUG_DISPLAY
on your site so we can see what the error was?
How to enable: https://codex.wordpress.org/WP_DEBUG
Essentially this requires you adding/updating two lines of code in your wp-config.php
file:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
Then we should see a more detailed error message instead of the one I can see in your screenshot.
Best
-
This reply was modified 2 years, 5 months ago by Code Amp.
I’ve enabled the debug mode and this is a copy of the detailed error message I am receiving:
Error message
Thanks!
Thanks @stephcerratti
I’ll be testing compatibility with ACF again tomorrow, hopefully I can recreate your issue!
Best
Hey @stephcerratti
I managed to figure out what this issue is 🙂
Essentially, the ACF shortcode doesn’t behave as expected when using it.
I tried the exact same shortcode (with a relationship field) in a reglar WP post, and it threw the same error… so that’s good to know the issue is not in our plugin.
It turns out the problem with relationship fields is there is not necessarily one way to display them (so I don’t think ACF has a default way to display the field)…
At least in my testing this was giving me the same issue.
Anway, I decided to make a new shortcode, which adds a simple display of relationship fields. You can find that here:
https://gist.github.com/rmorse/22982fe907988359bd10ace36ce790bf#file-acf-relationship-field-shortcode-php
You first need to copy that to your themes functions.php file (it should be in your child theme).
The way to use this is like this:
https://snipboard.io/rmsgER.jpg
[ca_acf_relationship_field field="field_name"]
If you want to customise how this looks, you’ll have to modify the first code snippet I provided (the github link).
Give that a spin and let me know if it works out for you?
Best
– Ross
-
This reply was modified 2 years, 5 months ago by Code Amp.