Display During Conditional Shortcode

Description

Specify the start and end date / times you’d like content enclosed by the shortcode to be displayed during. Optionally include a message or different content to display once that time period has passed.

Shortcodes:

Insert [display_during end_day_time="June 27, 2015 10:00 am" message="Sorry, this content no longer available."]CONTENT_TO_DISPLAY[/display_during] into any post or page to conditionally display whatever is inside of the shortcode. The message parameter you specify will display if the start and end time parameters are not currently valid.

Shortcode parameters

[display_during start_day_time="Sun 8:00 am" end_day_time="Mon 8:00 pm" timezone_location="America/Denver" message="Sorry, this content is not currently available."]CONTENT_TO_DISPLAY[/display_during]
  • start_day_time – OPTIONAL – What day/time or time of day should the contents start being displayed?
  • end_day_time – REQUIRED – What day/time or time of day should the content of the shortcode stop being displayed?
  • timezone_location – OPTIONAL – The timezone uses by default whatever is set for the site in Settings > General. You can use this optional parameter to specify a different timezone location. Uses the standard PHP timezones

Screenshots

  • Edit screen - add your shortcode either using Visual or Text
  • Content shown during valid dates
  • Content not available message being shown

FAQ

What are valid time settings for start_day_time and end_day_time?

The plugin uses PHP’s strtotime() function to decipher start and end times. You can specify either a specific start and end date (i.e. June 27, 2015 10:00 am) or you can also specify a start and end time as days of the week (i.e. start_day_time=”Sun 8:00 am” and end_day_time=”Mon 8:00 pm”. This second method will display content starting Sunday at 8:00 am and stop displaying it the day after (Monday) at 8:00 pm.

Only end_day_time is required. If start_day_time is omitted, now is used for the start_day_time, and end_day_time will determine when to stop displaying the content.

Can I use either Visual or Text mode?

Yes. Both are supported, although if you’re entering HTML / CSS as the content, you may want to edit the page using Text mode.

Is support available?

Yes, use the contact form on the ShareThePractice.org website.

Changelog

1.1

  • Public release of plugin to WordPress repository. Hello World! 🙂

1.0

  • Initial version of plugin, internal release only

Contributors & Developers

This is open source software. The following people have contributed to this plugin.

Contributors

Browse the code