{"id":22372,"date":"2013-03-08T21:12:38","date_gmt":"2013-03-08T21:12:38","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/display-during-conditional-shortcode\/"},"modified":"2026-02-07T00:49:03","modified_gmt":"2026-02-07T00:49:03","slug":"display-during-conditional-shortcode","status":"publish","type":"plugin","link":"https:\/\/cy.wordpress.org\/plugins\/display-during-conditional-shortcode\/","author":37705,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"2.0","stable_tag":"2.0","tested":"6.9.4","requires":"6.1","requires_php":"7.0","requires_plugins":null,"header_name":"Display During Conditional Shortcode","header_author":"Gabriel Serafini (ShareThePractice.org)","header_description":"","assets_banners_color":"fffef5","last_updated":"2026-02-07 00:49:03","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/sharethepractice.org\/plugins\/display-during-conditional-shortcode\/","header_plugin_uri":"https:\/\/sharethepractice.org\/plugins\/display-during-conditional-shortcode\/","header_author_uri":"http:\/\/sharethepractice.org\/","rating":5,"author_block_rating":0,"active_installs":200,"downloads":4637,"num_ratings":3,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.1":{"tag":"1.1","author":"gserafini","date":"2017-11-09 00:51:39"},"1.2":{"tag":"1.2","author":"gserafini","date":"2025-06-21 01:39:51"},"1.3":{"tag":"1.3","author":"gserafini","date":"2026-02-06 01:12:30"},"1.4":{"tag":"1.4","author":"gserafini","date":"2026-02-06 01:24:47"},"2.0":{"tag":"2.0","author":"gserafini","date":"2026-02-07 00:49:03"}},"upgrade_notice":{"2.0":"<p>New Gutenberg block with visual schedule controls, recurring day\/time scheduling, and rich fallback messages. Shortcodes convert to blocks automatically. 100% backward compatible. Requires WordPress 6.1+.<\/p>","1.4":"<p>Adds support for start-only dates (show content permanently after a date).<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"4"},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":1782990,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":1782990,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":{"banner-1544x500.jpg":{"filename":"banner-1544x500.jpg","revision":678350,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":678350,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":{"stp\/display-during":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"stp\/display-during","version":"2.0.0","title":"Display During","category":"design","description":"Show or hide content based on a date\/time schedule.","keywords":["schedule","conditional","date","time","display"],"textdomain":"display-during-conditional-shortcode","attributes":{"isRecurring":{"type":"boolean","default":false},"isAdvanced":{"type":"boolean","default":false},"startDateTime":{"type":"string","default":""},"endDateTime":{"type":"string","default":""},"recurringDays":{"type":"array","default":[]},"recurringStartTime":{"type":"string","default":""},"recurringEndTime":{"type":"string","default":""},"customStart":{"type":"string","default":""},"customEnd":{"type":"string","default":""},"timezone":{"type":"string","default":""},"showFallback":{"type":"boolean","default":false}},"providesContext":{"stp\/showFallback":"showFallback"},"supports":{"html":false,"align":["wide","full"]},"editorScript":"file:.\/index.js","editorStyle":"file:.\/index.css"},"stp\/display-during-content":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"stp\/display-during-content","version":"2.0.0","title":"Display During: Content","category":"design","description":"Main content zone \u2014 displayed when the schedule conditions are met.","textdomain":"display-during-conditional-shortcode","parent":["stp\/display-during"],"supports":{"html":false,"reusable":false,"inserter":false},"editorScript":"file:.\/index.js"},"stp\/display-during-message":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"stp\/display-during-message","version":"2.0.0","title":"Display During: Message","category":"design","description":"Fallback message zone \u2014 displayed when the schedule conditions are NOT met.","textdomain":"display-during-conditional-shortcode","parent":["stp\/display-during"],"usesContext":["stp\/showFallback"],"supports":{"html":false,"reusable":false,"inserter":false},"editorScript":"file:.\/index.js"}},"tagged_versions":["1.1","1.2","1.3","1.4","2.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":678347,"resolution":"1","location":"assets","locale":""},"screenshot-2.png":{"filename":"screenshot-2.png","revision":678347,"resolution":"2","location":"assets","locale":""},"screenshot-3.png":{"filename":"screenshot-3.png","revision":678347,"resolution":"3","location":"assets","locale":""}},"screenshots":{"1":"Block Editor - Display During block with schedule sidebar","2":"Block Editor - Recurring schedule with day checkboxes","3":"Content shown during valid dates","4":"Fallback message shown when schedule is not active"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1220,4060,1578,4062,80],"plugin_category":[43],"plugin_contributors":[90615],"plugin_business_model":[],"class_list":["post-22372","plugin","type-plugin","status-publish","hentry","plugin_tags-block","plugin_tags-conditional","plugin_tags-display","plugin_tags-schedule","plugin_tags-shortcode","plugin_category-customization","plugin_contributors-gserafini","plugin_committers-gserafini"],"banners":{"banner":"https:\/\/ps.w.org\/display-during-conditional-shortcode\/assets\/banner-772x250.jpg?rev=678350","banner_2x":"https:\/\/ps.w.org\/display-during-conditional-shortcode\/assets\/banner-1544x500.jpg?rev=678350","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/display-during-conditional-shortcode\/assets\/icon-128x128.png?rev=1782990","icon_2x":"https:\/\/ps.w.org\/display-during-conditional-shortcode\/assets\/icon-256x256.png?rev=1782990","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/display-during-conditional-shortcode\/assets\/screenshot-1.png?rev=678347","caption":"Block Editor - Display During block with schedule sidebar"},{"src":"https:\/\/ps.w.org\/display-during-conditional-shortcode\/assets\/screenshot-2.png?rev=678347","caption":"Block Editor - Recurring schedule with day checkboxes"},{"src":"https:\/\/ps.w.org\/display-during-conditional-shortcode\/assets\/screenshot-3.png?rev=678347","caption":"Content shown during valid dates"}],"raw_content":"<!--section=description-->\n<p>Display content conditionally based on a schedule. Choose from three scheduling modes:<\/p>\n\n<ol>\n<li><strong>Date Range<\/strong> - Show content between specific start and end dates<\/li>\n<li><strong>Recurring<\/strong> - Show content on specific days of the week during a time window<\/li>\n<li><strong>Custom<\/strong> - Use PHP strtotime expressions for flexible scheduling<\/li>\n<\/ol>\n\n<h4>Gutenberg Block<\/h4>\n\n<p>The <strong>Display During<\/strong> block provides a visual editor with:<\/p>\n\n<ul>\n<li>Sidebar controls for all three scheduling modes<\/li>\n<li>Date\/time pickers for start and end dates<\/li>\n<li>Day-of-week checkboxes for recurring schedules<\/li>\n<li>Live status indicator (active\/inactive)<\/li>\n<li>Optional fallback message when content is hidden<\/li>\n<li>Copy as Shortcode toolbar button<\/li>\n<\/ul>\n\n<h4>Shortcodes<\/h4>\n\n<p>The <code>[display_during]<\/code> shortcode works in the Classic Editor and anywhere shortcodes are supported.<\/p>\n\n<p><strong>Date range:<\/strong>\n    [display_during start_day_time=\"June 1, 2026 8:00 am\" end_day_time=\"December 31, 2026 11:59 pm\"]Content here[\/display_during]<\/p>\n\n<p><strong>Recurring schedule (new in 2.0):<\/strong>\n    [display_during days=\"mon,wed,fri\" start_time=\"09:00\" end_time=\"17:00\"]Office hours content[\/display_during]<\/p>\n\n<p><strong>Custom strtotime:<\/strong>\n    [display_during start_day_time=\"Sun 8:00 am\" end_day_time=\"Mon 8:00 pm\"]Weekend content[\/display_during]<\/p>\n\n<p><strong>With fallback message:<\/strong>\n    [display_during end_day_time=\"June 1, 2026\"]Register now![display_during_message]Registration has closed.[\/display_during_message][\/display_during]<\/p>\n\n<h4>Shortcode Parameters<\/h4>\n\n<ul>\n<li><code>start_day_time<\/code> - When to start showing content (strtotime string or date)<\/li>\n<li><code>end_day_time<\/code> - When to stop showing content<\/li>\n<li><code>days<\/code> - Comma-separated days for recurring mode (mon,tue,wed,thu,fri,sat,sun)<\/li>\n<li><code>start_time<\/code> - Start time for recurring mode (HH:MM format)<\/li>\n<li><code>end_time<\/code> - End time for recurring mode (HH:MM format)<\/li>\n<li><code>timezone_location<\/code> - PHP timezone identifier (defaults to site timezone)<\/li>\n<li><code>message<\/code> - Plain text fallback message (legacy; use nested shortcode for rich content)<\/li>\n<\/ul>\n\n<!--section=installation-->\n<h4>Install via Plugins &gt; Install New<\/h4>\n\n<ol>\n<li>Search for \"Display During Conditional Shortcode\"<\/li>\n<li>Click the \"Install Now\" link<\/li>\n<li>Click \"Activate Plugin\"<\/li>\n<\/ol>\n\n<h4>Via ZIP \/ FTP<\/h4>\n\n<ol>\n<li>Unzip the ZIP file and drop the folder straight into your wp-content\/plugins directory.<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress.<\/li>\n<\/ol>\n\n<h4>Using the Block Editor<\/h4>\n\n<ol>\n<li>Add a new block and search for \"Display During\"<\/li>\n<li>Configure the schedule in the sidebar<\/li>\n<li>Add content to the Content zone<\/li>\n<li>Optionally enable and add a fallback message<\/li>\n<\/ol>\n\n<h4>Using the Shortcode<\/h4>\n\n<ol>\n<li>Insert <code>[display_during end_day_time=\"June 27, 2026 10:00 am\"]Your content[\/display_during]<\/code><\/li>\n<li>Publish and view the post or page<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"how%20do%20i%20show%20content%20on%20a%20recurring%20schedule%3F\"><h3>How do I show content on a recurring schedule?<\/h3><\/dt>\n<dd><p>Use the Recurring mode in the block sidebar, or the shortcode <code>days<\/code> parameter:<\/p>\n\n<pre><code>[display_during days=\"mon,wed,fri\" start_time=\"09:00\" end_time=\"17:00\"]Weekday content[\/display_during]\n<\/code><\/pre><\/dd>\n<dt id=\"what%20are%20valid%20time%20settings%20for%20start_day_time%20and%20end_day_time%3F\"><h3>What are valid time settings for start_day_time and end_day_time?<\/h3><\/dt>\n<dd><p>The plugin uses PHP's <a href=\"http:\/\/php.net\/manual\/en\/function.strtotime.php\">strtotime()<\/a> function. You can specify a specific date (e.g. \"June 27, 2026 10:00 am\") or a relative expression (e.g. \"Sun 8:00 am\", \"Today 9am\").<\/p>\n\n<p>Either <code>start_day_time<\/code> or <code>end_day_time<\/code> (or both) must be provided. If <code>start_day_time<\/code> is omitted, \"now\" is used. If <code>end_day_time<\/code> is omitted, content is shown permanently after the start time.<\/p><\/dd>\n<dt id=\"can%20i%20show%20content%20only%20after%20a%20certain%20date%3F\"><h3>Can I show content only after a certain date?<\/h3><\/dt>\n<dd><p>Yes! Use <code>start_day_time<\/code> without <code>end_day_time<\/code>:\n    [display_during start_day_time=\"June 1, 2026 8:00 am\" message=\"Coming soon!\"]Content[\/display_during]<\/p><\/dd>\n<dt id=\"can%20i%20show%20rich%20fallback%20content%20instead%20of%20plain%20text%3F\"><h3>Can I show rich fallback content instead of plain text?<\/h3><\/dt>\n<dd><p>Yes! Use the nested <code>[display_during_message]<\/code> shortcode:\n    [display_during end_day_time=\"June 1, 2026\"]Main content[display_during_message]<strong>Sorry<\/strong>, this is no longer available.[\/display_during_message][\/display_during]<\/p>\n\n<p>In the block editor, check \"Show optional message when not displayed\" to reveal the message zone.<\/p><\/dd>\n<dt id=\"does%20the%20block%20work%20with%20the%20classic%20editor%3F\"><h3>Does the block work with the Classic Editor?<\/h3><\/dt>\n<dd><p>Yes. The block saves a real shortcode in the post content, so it round-trips cleanly between the Block Editor and Classic Editor.<\/p><\/dd>\n<dt id=\"can%20i%20convert%20existing%20shortcodes%20to%20blocks%3F\"><h3>Can I convert existing shortcodes to blocks?<\/h3><\/dt>\n<dd><p>Yes. The plugin includes a shortcode-to-block transform. Existing <code>[display_during]<\/code> shortcodes can be converted using the \"Convert to Blocks\" feature.<\/p><\/dd>\n<dt id=\"is%20support%20available%3F\"><h3>Is support available?<\/h3><\/dt>\n<dd><p>Yes, use the contact form on the ShareThePractice.org <a href=\"http:\/\/sharethepractice.org\/contact\/\">website<\/a>.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>2.0<\/h4>\n\n<ul>\n<li>New: Gutenberg block with visual schedule controls (Dates, Recurring, Custom modes)<\/li>\n<li>New: Recurring schedule mode - show content on specific days of the week during a time window<\/li>\n<li>New: Nested [display_during_message] shortcode for rich fallback content (HTML, shortcodes, media)<\/li>\n<li>New: Shortcode-to-block transform for converting existing shortcodes<\/li>\n<li>New: Copy as Shortcode toolbar button in block editor<\/li>\n<li>New: Live schedule status indicator in editor (active\/inactive\/unknown)<\/li>\n<li>New: Shared schedule evaluation engine used by both block and shortcode<\/li>\n<li>New: Full i18n support with .pot file for translations<\/li>\n<li>Improvement: Refactored shortcode handler to use shared evaluator<\/li>\n<li>Improvement: All date comparisons use integer timestamps (fixes microsecond comparison bug)<\/li>\n<li>Requires WordPress 6.1+ (for block editor support)<\/li>\n<\/ul>\n\n<h4>1.4<\/h4>\n\n<ul>\n<li>Feature: Support start_day_time without end_day_time to show content permanently after a date<\/li>\n<li>end_day_time is no longer required when start_day_time is provided<\/li>\n<\/ul>\n\n<h4>1.3<\/h4>\n\n<ul>\n<li>Security: Sanitize all shortcode attributes with sanitize_text_field() and wp_kses_post()<\/li>\n<li>Security: Validate timezone against timezone_identifiers_list() before use<\/li>\n<li>Improvement: Rewrite date handling using DateTime\/DateTimeZone objects instead of date_default_timezone_set()<\/li>\n<li>Improvement: Add try\/catch for invalid date\/time strings in shortcode attributes<\/li>\n<li>Coding standards: Full PHPCS WordPress-Extra compliance<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>Bug fix to reset timezone back to whatever it was before the shortcode runs<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>Public release of plugin to WordPress repository<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial version of plugin, internal release only<\/li>\n<\/ul>","raw_excerpt":"Show or hide content based on date ranges, recurring day\/time schedules, or custom strtotime expressions. Includes a Gutenberg block and shortcode.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/22372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=22372"}],"author":[{"embeddable":true,"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/gserafini"}],"wp:attachment":[{"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=22372"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=22372"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=22372"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=22372"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=22372"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/cy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=22372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}