Display ACF Repeater

WordPress
6 April, 2023 01:27:55
Gderon
Topics: 4
Messages: 20
Hello,

I have trouble displaying the content of an ACF Repeater field correctly.
I've looked through your how-to forum, I've tried various things based on what I've read (see pictures), but the repeater field still doesn't display. Instead, I see the number of entries in this repeater for this particular dataset (3).

Can you point me to a solution?
6 April, 2023 03:36:32
E2Pdf
Support
Topics: 7
Messages: 3176
Hi,

It looks like it's missed code in your functions.php or it was not set the correct value.

1. You need to add code to your theme functions.php or as a PHP snippet: https://codeshare.io/vwDPe4

2. It must be used shortcode as:

[acf_repeater field="defunt_enf_min" post_id="[id]"]
Nom: [acf field='defunt_enf_min_%ROW%_nom' post_id='[id]']
Age: [acf field='defunt_enf_min_%ROW%_age' post_id='[id]']
[/acf_repeater]

* Be sure that you are using the correct field names.

** If you are using an "HTML" object, it's also recommended to set "Disable WYSIWYG Editor" and put the shortcodes directly to the "Value" via "Right Mouse Click" -> "Properties". See please screenshot attached.

If you will not succeed, let us know please, do you get any output from the shortcode:
[acf field='defunt_enf_min_0_nom']

If not, attach please some screenshots with your ACF Fields setup.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
6 April, 2023 07:20:42
Gderon
Topics: 4
Messages: 20
Hello again,

I have placed the PHP snippet,
I simplified the names of the ACF fields
I placed and adapted the shortcode, but still nothing on the PDF.

I tried the simple shortcode, no result.
6 April, 2023 07:27:48
Gderon
Topics: 4
Messages: 20
I am very sorry for the duplicated answers....

I add a picture of the dataset.
6 April, 2023 08:45:00
E2Pdf
Support
Topics: 7
Messages: 3176
Sorry, it looks like our mistake, we missed the part of the shortcode in the iteration, it must be added post_id="[id]" attribute.

Can you try to update the shortcode to:

[acf_repeater field="defunt_enf_min" post_id="[id]"]
Nom: [acf field="defunt_enf_min_%ROW%_nom" post_id="[id]"]
Age: [acf field="defunt_enf_min_%ROW%_age" post_id="[id]"]
[/acf_repeater]

Or if your new name is "defunt_enf":

[acf_repeater field="defunt_enf" post_id="[id]"]
Nom: [acf field="defunt_enf_%ROW%_nom" post_id="[id]"]
Age: [acf field="defunt_enf_%ROW%_age" post_id="[id]"]
[/acf_repeater]

And single shortcode to:

Nom: [acf field="defunt_enf_min_0_nom" post_id="[id]"]
or
Nom: [acf field="defunt_enf_0_nom" post_id="[id]"]

It must work, but if it still will not work and it's acceptable for you, you can submit a support ticket with access details to WP Admin Dashboard so we can log in and do some additional tests: https://e2pdf.com/support/request
We would really appreciate your feedback at WordPress.org!
6 April, 2023 09:01:38
Gderon
Topics: 4
Messages: 20
It works! Or almost...

There is still a problem that I encounter outside the Repeater field.

I have the value of my first ACF field (which is text),
but the second field is a yes/no with a stylized presentation (see picture). (and I use several of them in my forms)
In ACF, the active value is 'Major', the inactive value is 'Minor'.
In the dataset, 2 entries are Major, one is Minor.
On the PDF, the 2 major entries display 1 and the minor entry displays nothing.

I feel that the problem is mine, but I have searched and searched on your site without succeeding in displaying correctly the values selected in the forms.

Thanks for continuing to help me.
6 April, 2023 10:54:34
E2Pdf
Support
Topics: 7
Messages: 3176
It's because ACF shortcode outputs "1" when the "True / False" field is "checked" and nothing when not. Currently, we didn't find any solution except adding a separate shortcode to modify its output. It seems there is no way to output "UI ON/OFF Text" with default shortcode additional attributes.

Here is an example: https://codeshare.io/r90LPY

After adding to theme functions.php or as a PHP snippet, you must be able to replace the shortcode on the "age" field as below from "acf" to "acf-toggle" to output UI Text:

[acf_repeater field="defunt_enf" post_id="[id]"]
Nom: [acf field="defunt_enf_%ROW%_nom" post_id="[id]"]
Age: [acf-toggle field="defunt_enf_%ROW%_age" post_id="[id]"]
[/acf_repeater]
We would really appreciate your feedback at WordPress.org!
6 April, 2023 23:49:45
Gderon
Topics: 4
Messages: 20
Hello again,

I must have made a mistake somewhere...

I added the PHP snippet, I modified the code in the template as you told me.
But the PDF doesn't show the value of the ACF yes/no field.
7 April, 2023 03:00:23
E2Pdf
Support
Topics: 7
Messages: 3176
Hi,

Can you please attach also a screenshot of the PHP snippet?
We would really appreciate your feedback at WordPress.org!
7 April, 2023 03:05:29
Gderon
Topics: 4
Messages: 20
Sure.
7 April, 2023 04:01:39
E2Pdf
Support
Topics: 7
Messages: 3176
Everything seems okay. Unfortunately, we need to debug the code. You need to submit a support ticket so we can log in and do additional checks: https://e2pdf.com/support/request
We would really appreciate your feedback at WordPress.org!