Pro 6.1.5 - Conditions on ACF repeater fields causing issues

I have a site built in Pro 5.

I have an ACF repeater on a CPT that is optional.

In the section on the page I have a dynamic looper provider. Inside this is a heading followed by the consumer that displays the repeater info.

If there is no repeater data then I have a condition to hide everything if the Provider output is empty.

In Pro 5 this works and I can work in the builder and on the front-end everything works as expected.

In Pro 6.0 & Pro 6.1 this works on the front-end but I can’t work on the pages / layouts in Cornerstone. I get the error where it says I can’t display the page due to the origin being different to the source? (or something to that effect.)

If I inspect the page then I am getting an error 500 in the console.

Is this a bug?

If not what is the best practice for a conditional that will hide a section should the repeater not exist on the CPT?

Hello @urchindesign,

Thanks for writing to us.

In order to help you with your concerns we need to check your settings I would request you, please share the admin login details meanwhile I would suggest you troubleshoot a few of the common issues before we investigate your settings. Please share your details in a secure note. Please provide the following details

  • WordPress Login URL
  • Admin-level username and password

You can find the Secure Note button at the bottom of your posts

Thanks

Unfortunately due to NDA’s I cannot supply login details to this site.

As mentioned, with the structure below, adding “Provider output is empty” as a condition to the seciton with the provider worked in Pro 5. In Pro 6 it works on the front-end but breaks the page in the builder.

Can you just supply me with the best way to not show a section that contains an ACF repeater should the ACF repeater either not exist or be empty.

The set up is the following:

<section some padding> - looper provider using dynamic content to get repeater
<row>Heading</row>
<div> - looper consumer
All the stuff
</div>
</section>

If the dynamic looper is empty or whatever because the ACF repeater doesn’t contain any elements then the entire section should be hidden.

Hello @urchindesign,

We would love to investigate this issue. It could be how the data is structured or could be a setting. Anyways, you can also use this nifty CSS to hide away empty sections:

.element-class:empty {
   display: none;
}

The code above serves as an example code. Feel free to modify it when needed. Please note that custom coding is beyond the scope of our support. You will have to maintain any custom coding to make sure that it will still work after any updates or does not create any issues or incompatibility in the future.

Best Regards.

Thanks. I don’t want to output unnecessary content, this means hiding it with CSS is not ideal.

I’ve set up a dummy site and I’ll provide instructions and details in a secure note. The dummy site is a fresh install, with a fresh installation of Pro 6.1.6.

I’ve imported and CPT and ACF fields from the other site and copied the template across. Keep in mind the set up was working in Pro5. I’ve then manually added an expert / cpt.

The ACF fields have two repeaters. In this instance there are two optional repeaters.

  1. Prizes & Awards
  2. Memberships and professional bodies.

I’ve added repeaters to Professional bodies and left Prizes and Awards empty. This means we’ve never added any prizes to the expert.

If we view the front-end the entire output for the section relating to Prizes and Awards is not visible in the HMTL and it is not hidden with CSS.

If you now open cornerstone and select the layout the page opens BUT as soon as you change the preview to preview the expert then you get the error “The preview could not load due to the iframe response being incomplete…”

If you look at the Outline and look at the Expert Info section, 2nd row, Column 2 you will see all the sections.

The issue occurs with the two sections

  1. Prizes / Awards
  2. Memberships

Both of these have a dynamic content looper provider.

To get this to more or less work I made two headlines. Both are set as looper consumers with a condition “Provider Output is not empty”.

It is a bit of a work around but worked and works on the front end.

In the builder it breaks and as soon as I remove “Provider Output is not empty” then the preview loads in the builder.

Ideally I want to know what I can add to the provider to hide the output on the front-end as this would seem to be a common use case. i.e. I would like to add something onto the container Prizes / Awards where I’ve set the consumer so that it is hidden if the repeater / provider is empty.

In the builder if you inspect the current set up it throws an error 500 even though it works on the front-end.

Hey @urchindesign,

I deactivated ACF and the page loaded in Cornerstone. This means there’s a conflict somewhere so I’m going to post this in our issue tracker to be investigate by our development team.

Please stay tuned.

Thanks.

We will have a fix for this in the next release. The provider output show condition is what is causing this error. Thanks and let me know if this issue persists!

1 Like

Thanks for letting me know. I thought it was a bug but… looking forward to a fix.

Hey @urchindesign,

The new update for the fix on this issue was already released. Please update your theme to the latest version and let us know how it goes. If you want to know more about the new updates, please check this out.

Thank you.

Thanks Marc. I see this is working however I am still having an issue with “Provider output” conditionals.

In ACF I have set up a relationship field. We have experts that aren’t users but the client wants to show articles that have been co-written with the expert.

I’ve created a relationship field on the expert so the client can select and add articles to the expert. This works 100% but I can’t find a way to hide the section with the provider should there be no articles assigned to the particular expert.

We obviously don’t want a section with headings about reading articles by or expert when there is no relationship between the expert and any articles.

Hello @urchindesign,

I have checked your single layout and I am not seeing an element with a Looper Provider to display those articles. Normally, the Looper Provider should be added in a DIV element that contains both the Looper Consumer and your Headline so that when you apply the condition “Provider output”, it will work.

Please provide us with the correct layout or at least the Looper elements in your layout so we can check.

Thanks.

Unfortunately this issue is on our staging site.

The site in the secure now was quickly set up for the previous bug.

As you will see it does not contain any articles but this should be a simple enough thing to test on your end.

Hello @urchindesign,

I edited your custom layout in your staging area to test. the condition:

It is working on my test.

If I remove the prizes and awards, nothing will display:

Please check out the demo in the secure below.

Best Regards.

This is a different issue. I have now added some dummy posts. I have added the ACF relationship field. You can see that with no relationships selected the “News, insight & opinion” section is still visible.

What conditions would work to hide this entire section should the specific expert not have any articles assigned to them through the relationship field.

The ACF field is assigned to the expert so the client can select articles that are associated to the expert.

It has been 15 days since I opened this, and four days since my last question with no response.

Can someone get back to me on this. Thanks.

Provider Output only works when inside the provider. I don’t think it necessarily has to be in a consumer. I changed the condition to be something like the following on your staging. A good tip is to checkout what type="json" added to your dynamic content returns in a text element. ACF is very inconsistent with it’s return values which is why ACF issues take us a bit longer to solve.

image

image

Thanks for the feedback. As this was a new feature we added to the site I ended up making a switch.

This will be helpful going forward.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.