Repurposing Provider Palooza

Any update @christian @alexander :slight_smile:

Hi @dlukefinch,

I’m sorry for the delay here. Unfortunately there isn’t a condition you can add that will satisfy that “No advisories” panel based on the Looper itself. As long as advisories exist (regardless of their dates) the provider will not be considered empty.

There are two ways I can think of to solve this. The first option would be creating a custom provider. You would need to make a PHP function to retrieve the ACF fields and filter out items that don’t satisfy the date check. Doing this gives you full control over the data and because it would only return active advisories, you could use the “empty” condition of the Looper Provider. Doing this is a bit more involved and not something I can help with in support since it gets into custom development.

Another idea would be solving it with a little javascript. Try adding `active-advisory` to the same element that has the date condition. If any advisories are on the page, the body will get a `has-advisory` class.
if (document.querySelector('.active-advisory')) {

Then you can use the class to hide the no advisories message with some Element CSS on that element.

body:not(.has-advisory) $el {
  display: none;

This CSS/JS option is definitely more of a workaround to the custom looper, but it would be easier to implement.

Hello @alexander

Ok, would you consider adding that kind of provider? I’d imagine it would be an easier job for you and the rest of the Theme Co family would probably find it useful.

In the mean time I have added the second option. Oddly, within the preview it’s working but not when I view the site normally. I have cleared cache many times.

Hey Daniel,

The CSS that would work is this:

.has-advisory $el {
  display: none;

Alex now knows this limitation and I believe if there’s a way to easily achieve this in the future, it would surely be added.

Hope that helps.

Hey Christian,

Thanks. Looks like it’s working. I have noticed the No Advisories panel shows briefly while loading. I’m wondering if there’s anything that can be done about this?

See here:

Hey Daniel,

Regretfully, that has no solution for now. It would require more custom coding so this is going more involved so we can only continue with this in our One plan where we can answer custom development questions.

Thank you for understanding.


With all due respect and while I understand it’s slightly out of scope you did say you’d assist me in getting this working.

and yet you’re bailing out at the last hurdle? Frustrating to say the least. I have no problem paying for One plan and have considered it but don’t see the point considering the job is nearly done.


Hey Daniel,

I’m not bailing out. For that quick display of “No Advisory” element, I said:

Yes, it’s seemingly just a small part or nearly done but I would not say there’s currently no solution if there’s a simple one, or at least for now I could not think of any. That is why I recommended one because this takes some custom development time. If we continue working on this, this means all customers can request anything they wish.

I did say we’re happy to help to make this setup as an example and we did. Both Advisories and No Advisories are working now except that last seemingly simple problem of the quick display of the No Advisories element.

Please understand that even by that, we did beyond the scope of product support already. I’ll post this as a feature request so our development team will know about this case. Alex already knows but it would be good to note.

Again, thank you for understanding.

I understand @christian and I am sorry for coming across ungrateful. Thank you for working on that.

I am looking at a solution to that as well on Stack Exchange and one of my team has posted here:

I have also contacted WPMUDEV but regretfully I don’t have the extra money to spend on One right now.

@christian @alexander Had a chat with WPMUDEV.

They seem to think “the issue is mainly that your builder loads CSS later than the HTML Body content, and this causes that blinking issue.” they added

#cs-content .x-section .active-advisory { display: none ; }

to Appearance > Additional CSS within Wordpress and it showed but the conditions didn’t work as it was outside of the builder. Any thoughts?

Hey Daniel,

I am aware of the CSS loading and that’s the reason why there’s a bit of delay for the No Advisories to hide. There is currently no solution I could think of.


Ok. Probably not worth using One in that case? Or is there?

Hi @dlukefinch,

They seem to think “the issue is mainly that your builder loads CSS later than the HTML Body content, and this causes that blinking issue.” they added

All the CSS loads at the same time, but that javascript snippet doesn’t run until after the page loads. That’s why the flicker happens. Another approach would be to invert how the state is managed:

// add "no-advisories" to the body if we don't find any on the page.
  if (!document.querySelector('.active-advisory')) {
/* Hide the "no advisory" message until the class is present
body:not(.no-advisories) $el {
  display: none;

This should cause the “No Advisory” message to always be hidden, but pop in after a slight delay when no advisories are found.

Hello @alexander

There’s a few minutes delay in the " no advisory" panel hiding/showing, times it doesn’t work at all which is not ideal as I’m sure you can imagine but it’s progress at least.

Turns out there’s not a few minutes delay. Advisory expired and disappeared on 31st May and as I type (3rd June) the no advisories panel is still not showing… :thinking:

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