Skip Navigation

[Resolved] Countdown based on filter of custom post type

This thread is resolved. Here is a description of the problem and solution.

Problem:

The customer wanted to display a countdown for the next event date from a custom post type for a music band, using a date field as the target. Although they initially used the Spectra Pro countdown block, they encountered challenges setting a dynamic end date directly.

Solution:

The Toolset Countdown block can use dynamic data for the countdown's end date. However, to make this work with Spectra Pro or any countdown block that accepts shortcode-based data, the customer could format Toolset's date field from a UNIX timestamp to a format compatible with Spectra. The steps included:

1. Creating a View Loop: Even when displaying a single upcoming event, creating a View loop within Toolset allows the countdown block to be placed dynamically within the loop.

2. Formatting the Date for Compatibility: Toolset provides methods to convert the date field from UNIX format, ensuring compatibility with external blocks like Spectra Pro if shortcodes are required.

The customer confirmed this setup worked, with the Toolset Countdown block operating dynamically within the loop for future events.

Relevant Documentation:

https://toolset.com/forums/topic/can-i-convert-a-custom-fields-date-format/

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 1 reply, has 2 voices.

Last updated by Mateus Getulio 1 year, 8 months ago.

Assisted by: Mateus Getulio.

Author
Posts
#2779247

Hi! I am a bit confused (newbie so be patient): I created a custom post type for events for a music band.
I have a date field there and I'd like to filter the next event and show a countdown on the home page for that date.
I am using the spectra pro countdown block (since it doesn't seem to me that the toolset countdown block includes the possibility to set a dynamic value for the datetime of finish (maybe I am wrong on this).
I can create either a view or a block view with the required filter but I wonder how I can make this a custom field to feed the countdown block.

#2779297

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello Mauro,

The Countdown block works with dynamic data.

But if you prefer to work with Spectra pro and assuming it accepts data coming from shortcodes, even though Toolset stores date fields in timestamps UNIX format, you can base in this example to output it to a format that's accepted by Spectra:

https://toolset.com/forums/topic/can-i-convert-a-custom-fields-date-format/

Please give it a try and tell me how it goes.

Thank you,

Mateus

#2779333

Yes. Thank you.
BTW I clarified the usage. Writing it here for future enquiries on the same topic.
Even if you're looking for a single record... build a view loop and put the countdown inside the loop.
I can confirm the toolset countdown block works perfectly.