Skip Navigation

[Resolved] Date/Time … conditional display based on ???

This support ticket is created 3 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 3 years, 1 month ago.

Assisted by: Jamal.

Author
Posts
#2225213

Tell us what you are trying to do?

I work at a University, and I have created a Custom Post Type and View for Emergencies (like Fire, hurricanes, etc.).

We toggle the display of select Emergency posts on and off in the View output by a Category (Status ... Active or Inactive)

99% of the time there is no emergency ... and we have a single, 'default' Active post offering some general information.

I do NOT want this 'default' post the show Date/Time ... it's timeless, and a date/time might confuse users.

When an actual emergency happens, we create POSTS giving people status and instructions.

We DO want these posts to show Date/Time in the View ... as are critical details.

Is there a way, in a View, to show (or hide) Date/Time conditionally for certain posts?

I'm having my post writers add the Date/Time manually to their Post Content (Body).

It would be nice to display via the publication date/time... and would help decrease user error.

Much thanks for any ideas you can offer 🙂

Is there any documentation that you are following?

None

Is there a similar example that we can see?

Sorry - I do not have.

What is the link to your site?

The site is not publically available --- in dev.

#2226123

Hello and thank you for contacting the Toolset support.

I am not sure to correctly understand your requirements, but I'll give it a try. I understand that you want to display date/time from a custom field only for the Emergencies posts with the status "Active", right?
If that's the case, you can use a conditional shortcode(if you are building the view using the legacy editor) or a conditional block(if you are building the view with blocks) and check against the status. If the status is active display the date/time field, otherwise do not.

Read more about it on the following articles:
- https://toolset.com/course-lesson/using-toolset-conditional-block/
- https://toolset.com/2021/08/5-advanced-uses-of-toolsets-conditional-block-in-wordpress/

I hope this helps. Let me know if you have any questions.