Repurposing Provider Palooza

Hello,

So I am planning to use Provider Palooza to display my winter weather warnings. This is my first time properly checking out loopers, consumers etc so please bear with me.

I have set up a custom post type called “Advisory” and also setup basic fields. I have assigned layouts to the post type single and archive and all is working fine.

I am having some trouble conditionally hiding/showing No Advisories and Advisories when there’s an active or preliminary warning. I also want the advisory to disappear (only available to be viewed on the archive page once the valid too time and date has passed. I’m sure this is possible just need a little direction since much of the heavy lifting has been done by the design cloud template Provider Palooza.

Custom post type: https://a.cl.ly/Jru4Oo7G

Custom Fields: https://a.cl.ly/llu5E028

Hello Daniel,

Thank you for the very detailed post information. Your setup did not work because of your incorrect structure. The Looper Provider must not be the Looper Consumer.

Your structure should be like this:


 The Grid - Looper Provider

                 Cell 1 - Advisories
                          Div - Looper Consumer
                                    Figure element
                                    Title element
                                  
                 Cell 2 - No Advisories where you can have the condition "Provider Output is Empty"

Hope this makes sense.

Hello,

Ok, I THINK I have that sorted. But what about the bit below…

Hi Daniel,

With the correct structure, you should be able to place your condition so that the “No Advisories” warning will display properly.

You can make use of the Datetime and your dynamic content to display items before or after a particular date.

Hope this helps.

Hi, I’m not able to sort this…

With the valid date and time at Tue 20th Apr 2021 00:00 it’s still showing with the settings shown below?

Hey Daniel,

It looks like your condition is conflicting. Try removing the first condition for the No Advisories element to show if the Provider Output is empty.

image

Thanks.

Do you understand what I am trying to do here? I ask as your posts aren’t really helping. I took the time to write my original post so that you could clearly understand what I need this to be able to do…

Hello Daniel,

I have created a test layout and used the Query builder to display the Advisory published on a specific date.

Please see the secure note.

You can also run the query without the Date and then use the suggested condition as pointed out by Christian.

Please check the sample layout first.

Yes, I have added the published after Thu Apr 01 2021 but that only deals with the PUBLISHED date of the post and not the ACF fields. With all due respect I still don’t believe you’re understanding what I want here.

  • If Advisory has a status of Active or Preliminary and VALID TOO time and date is in present show on status page (if not only show on archive page).

I am also planning on setting up a cron job to check that when valid too field is reached or passed that the status is set to expired except if manually changed to withdrawn, for context.

Make sense?

Hey Daniel,

What you want sounds simple but it’s the setup is actually a bit complex. With that said, would you mind if breakdown the setup?

I started with the No Advisories as I responded to your screenshot which shows Provider Output is empty. Once No Advisories is solved, we can tackle the Advisories part.

Thanks.

Hi Daniel,

Try these steps:

  • Inspect the element that is the Looper Consumer
  • Go to Element Conditions
  • Add a Datetime condtion
    • On the left side, click the Dynamic Content icon and choose Current Date
    • Set the operator to after
    • On the right, enter {{dc:acf:post_field field="valid_from"}}
  • Click AND to add another condition
    • On the left side, once again choose Current Date
    • Set the operator to before
    • On the right, enter {{dc:acf:post_field field="valid_to"}}

For the dates to parse correctly, make sure there are no other characters in those inputs. Those conditions should cause the element to display only if the current date is in-between the from and to date’s of your advisory.

Hi @christian

Oh I know it’s complicated and I’ve only just started :laughing: but if we can pull it off like I suspect then this will be really useful. As far as I know the ‘No Advisories’ part is fine for the moment as I have followed instructions. It is just Provider Output is empty now.

Hello @alexander

I thought that might be the case. It seems when adding the datetime rules below all “test advisories” fanished from the status page. So, it didn’t work as desired…

{{dc:global:date}}+{{dc:global:time}} AFTER {{dc:acf:post_field field="valid_to"}} didn’t work either as it didn’t disappear from the status page once 21:00 came and went. We are close though, I think.

Hey Daniel,

Thanks for confirming the No Advisories part. We are happy to solve your setup because yes, it would be a useful Dynamic Content example.

Regarding the date DC not working, I will consult with Alex as he can see better.

Please stay tuned.

1 Like

Hi Daniel,

When the date before/after check runs it parses the content with PHP’s strtotime function. I think it might have something to do with how you’re having to combine {{dc:global:date}} and {{dc:global:time}}. We probably need to add a new one called “current time” or something that is just a combined timestamp.
Meanwhile, let me know if this works:

{{dc:global:date format="Y-m-d\TH:i:sO"}}

That should give you a ISO 8601 formatted time. If you try just adding it in a text element to test it you should see the current time displayed.

Here’s the output

Not quite the order I was hoping for but it works…

Hey Daniel,

Thanks for letting us know it works now.

The one you boxed in your screenshot though is outside the conditions and it’s just for output so you can change its format.

image

Hope that helps.

Ok, we’re getting closer to this working I think.

I set a test advisory to expire 4th May 2021 at 14:40 and at 14:40 it disappeared from the status page which is great but the No Advisories panel did not take it’s place…

It seems setting No Advisories conditions as Provider Output is empty doesn’t show once there’s no active advisories. Can you advise?

Note: I have changed Advisories conditions to {{dc:global:date format="Y-m-d\TH:i:sO"}} before {{dc:acf:post_field field="valid_to"}} this seems to work as per requirements.

Hey Daniel,

The condition for No Advisories then should be the reverse of your Advisories but this time, you use OR logic instead of AND because you’ll want that if any condition is TRUE, the element will be displayed. In the AND logic, all conditioins MUST be TRUE. So for the No Advisories:

  • Provider Output is empty = false because you have set a date
  • Current date/time after Valid To date = false because date is yet to come
  • Current date/time before Valid From date = true because date is before current date

In the screenshot below, you’ll see the No Advisories showing.

Hope that helps.

Can you take a look? When a advisory is in date it’s showing both panels. You’ll need to login.

Clearly, I have not got the hang of this :sweat_smile:

Hey Daniel,

The No Advisories conditions are all false so not sure why it’s showing up. I might be missing something so I’ll consult with Alex.

Please stay tuned.

1 Like