Title: Display During Conditional Shortcode
Author: Gabriel Serafini
Published: <strong>8 mars 2013</strong>
Last modified: 7 février 2026

---

Recherche d’extensions

![](https://ps.w.org/display-during-conditional-shortcode/assets/banner-772x250.
jpg?rev=678350)

![](https://ps.w.org/display-during-conditional-shortcode/assets/icon-256x256.png?
rev=1782990)

# Display During Conditional Shortcode

 Par [Gabriel Serafini](https://profiles.wordpress.org/gserafini/)

[Télécharger](https://downloads.wordpress.org/plugin/display-during-conditional-shortcode.2.0.zip)

 * [Détails](https://fr.wordpress.org/plugins/display-during-conditional-shortcode/#description)
 * [Avis](https://fr.wordpress.org/plugins/display-during-conditional-shortcode/#reviews)
 *  [Installation](https://fr.wordpress.org/plugins/display-during-conditional-shortcode/#installation)
 * [Développement](https://fr.wordpress.org/plugins/display-during-conditional-shortcode/#developers)

 [Support](https://wordpress.org/support/plugin/display-during-conditional-shortcode/)

## Description

Display content conditionally based on a schedule. Choose from three scheduling 
modes:

 1. **Date Range** – Show content between specific start and end dates
 2. **Recurring** – Show content on specific days of the week during a time window
 3. **Custom** – Use PHP strtotime expressions for flexible scheduling

#### Gutenberg Block

The **Display During** block provides a visual editor with:

 * Sidebar controls for all three scheduling modes
 * Date/time pickers for start and end dates
 * Day-of-week checkboxes for recurring schedules
 * Live status indicator (active/inactive)
 * Optional fallback message when content is hidden
 * Copy as Shortcode toolbar button

#### Shortcodes

The `[display_during]` shortcode works in the Classic Editor and anywhere shortcodes
are supported.

**Date range:**
 [display_during start_day_time= »June 1, 2026 8:00 am » end_day_time
= »December 31, 2026 11:59 pm »]Content here[/display_during]

**Recurring schedule (new in 2.0):**
 [display_during days= »mon,wed,fri » start_time
= »09:00″ end_time= »17:00″]Office hours content[/display_during]

**Custom strtotime:**
 [display_during start_day_time= »Sun 8:00 am » end_day_time
= »Mon 8:00 pm »]Weekend content[/display_during]

**With fallback message:**
 [display_during end_day_time= »June 1, 2026″]Register
now![display_during_message]Registration has closed.[/display_during_message][/display_during]

#### Shortcode Parameters

 * `start_day_time` – When to start showing content (strtotime string or date)
 * `end_day_time` – When to stop showing content
 * `days` – Comma-separated days for recurring mode (mon,tue,wed,thu,fri,sat,sun)
 * `start_time` – Start time for recurring mode (HH:MM format)
 * `end_time` – End time for recurring mode (HH:MM format)
 * `timezone_location` – PHP timezone identifier (defaults to site timezone)
 * `message` – Plain text fallback message (legacy; use nested shortcode for rich
   content)

## Captures d’écrans

[⌊Block Editor - Display During block with schedule sidebar⌉⌊Block Editor - Display
During block with schedule sidebar⌉[

Block Editor – Display During block with schedule sidebar

[⌊Block Editor - Recurring schedule with day checkboxes⌉⌊Block Editor - Recurring
schedule with day checkboxes⌉[

Block Editor – Recurring schedule with day checkboxes

[⌊Content shown during valid dates⌉⌊Content shown during valid dates⌉[

Content shown during valid dates

## Blocs

Cette extension fournit 3 blocs.

 *   Display During Show or hide content based on a date/time schedule.
 *   Display During: Content Main content zone — displayed when the schedule conditions
   are met.
 *   Display During: Message Fallback message zone — displayed when the schedule
   conditions are NOT met.

## Installation

#### Install via Plugins > Install New

 1. Search for « Display During Conditional Shortcode »
 2. Click the « Install Now » link
 3. Click « Activate Plugin »

#### Via ZIP / FTP

 1. Unzip the ZIP file and drop the folder straight into your wp-content/plugins directory.
 2. Activate the plugin through the ‘Plugins’ menu in WordPress.

#### Using the Block Editor

 1. Add a new block and search for « Display During »
 2. Configure the schedule in the sidebar
 3. Add content to the Content zone
 4. Optionally enable and add a fallback message

#### Using the Shortcode

 1. Insert `[display_during end_day_time="June 27, 2026 10:00 am"]Your content[/display_during]`
 2. Publish and view the post or page

## FAQ

### How do I show content on a recurring schedule?

Use the Recurring mode in the block sidebar, or the shortcode `days` parameter:

    ```
    [display_during days="mon,wed,fri" start_time="09:00" end_time="17:00"]Weekday content[/display_during]
    ```

### What are valid time settings for start_day_time and end_day_time?

The plugin uses PHP’s [strtotime()](http://php.net/manual/en/function.strtotime.php)
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 »).

Either `start_day_time` or `end_day_time` (or both) must be provided. If `start_day_time`
is omitted, « now » is used. If `end_day_time` is omitted, content is shown permanently
after the start time.

### Can I show content only after a certain date?

Yes! Use `start_day_time` without `end_day_time`:
 [display_during start_day_time
= »June 1, 2026 8:00 am » message= »Coming soon! »]Content[/display_during]

### Can I show rich fallback content instead of plain text?

Yes! Use the nested `[display_during_message]` shortcode:
 [display_during end_day_time
= »June 1, 2026″]Main content[display_during_message]**Sorry**, this is no longer
available.[/display_during_message][/display_during]

In the block editor, check « Show optional message when not displayed » to reveal
the message zone.

### Does the block work with the Classic Editor?

Yes. The block saves a real shortcode in the post content, so it round-trips cleanly
between the Block Editor and Classic Editor.

### Can I convert existing shortcodes to blocks?

Yes. The plugin includes a shortcode-to-block transform. Existing `[display_during]`
shortcodes can be converted using the « Convert to Blocks » feature.

### Is support available?

Yes, use the contact form on the ShareThePractice.org [website](http://sharethepractice.org/contact/).

## Avis

![](https://secure.gravatar.com/avatar/cc480362dc62995be42fbc01d8059502aa3d3ff90882433b9cf71076af7ad89e?
s=60&d=retro&r=g)

### 󠀁[Perfect!](https://wordpress.org/support/topic/perfect-7589/)󠁿

 [6strings](https://profiles.wordpress.org/6strings/) 22 août 2020

Very simple, flexible and useful plugin. Saved a lot of time that would have otherwise
been spent coding.

![](https://secure.gravatar.com/avatar/0be5da5eb605b5b51ff909ef15888f0f97ff07448cbbcfc937fba35beacb7ba7?
s=60&d=retro&r=g)

### 󠀁[I use it for my event weather report](https://wordpress.org/support/topic/i-use-it-for-my-event-weather-report/)󠁿

 [gotti75](https://profiles.wordpress.org/gotti75/) 7 septembre 2017

I use this widget in my event calender to display the weather forecast using two
different views. If there are 2-7 days left until the event starts I use the 7-day
forecast widget. If there are less than 2 days left I use the intraday-weather forecast
of another widget. That works great!

 [ Lire les 4 avis ](https://wordpress.org/support/plugin/display-during-conditional-shortcode/reviews/)

## Contributeurs/contributrices & développeurs/développeuses

« Display During Conditional Shortcode » est un logiciel libre. Les personnes suivantes
ont contribué à cette extension.

Contributeurs

 *   [ Gabriel Serafini ](https://profiles.wordpress.org/gserafini/)

[Traduisez « Display During Conditional Shortcode » dans votre langue.](https://translate.wordpress.org/projects/wp-plugins/display-during-conditional-shortcode)

### Le développement vous intéresse ?

[Parcourir le code](https://plugins.trac.wordpress.org/browser/display-during-conditional-shortcode/),
consulter le [SVN dépôt](https://plugins.svn.wordpress.org/display-during-conditional-shortcode/),
ou s’inscrire au [journal de développement](https://plugins.trac.wordpress.org/log/display-during-conditional-shortcode/)
par [RSS](https://plugins.trac.wordpress.org/log/display-during-conditional-shortcode/?limit=100&mode=stop_on_copy&format=rss).

## Journal des modifications

#### 2.0

 * New: Gutenberg block with visual schedule controls (Dates, Recurring, Custom 
   modes)
 * New: Recurring schedule mode – show content on specific days of the week during
   a time window
 * New: Nested [display_during_message] shortcode for rich fallback content (HTML,
   shortcodes, media)
 * New: Shortcode-to-block transform for converting existing shortcodes
 * New: Copy as Shortcode toolbar button in block editor
 * New: Live schedule status indicator in editor (active/inactive/unknown)
 * New: Shared schedule evaluation engine used by both block and shortcode
 * New: Full i18n support with .pot file for translations
 * Improvement: Refactored shortcode handler to use shared evaluator
 * Improvement: All date comparisons use integer timestamps (fixes microsecond comparison
   bug)
 * Requires WordPress 6.1+ (for block editor support)

#### 1.4

 * Feature: Support start_day_time without end_day_time to show content permanently
   after a date
 * end_day_time is no longer required when start_day_time is provided

#### 1.3

 * Security: Sanitize all shortcode attributes with sanitize_text_field() and wp_kses_post()
 * Security: Validate timezone against timezone_identifiers_list() before use
 * Improvement: Rewrite date handling using DateTime/DateTimeZone objects instead
   of date_default_timezone_set()
 * Improvement: Add try/catch for invalid date/time strings in shortcode attributes
 * Coding standards: Full PHPCS WordPress-Extra compliance

#### 1.2

 * Bug fix to reset timezone back to whatever it was before the shortcode runs

#### 1.1

 * Public release of plugin to WordPress repository

#### 1.0

 * Initial version of plugin, internal release only

## Méta

 *  Version **2.0**
 *  Dernière mise à jour **il y a 5 mois**
 *  Installations actives **200+**
 *  Version de WordPress ** 6.1 ou plus **
 *  Testé jusqu’à **6.9.4**
 *  Version de PHP ** 7.0 ou plus **
 *  Langue
 * [English (US)](https://wordpress.org/plugins/display-during-conditional-shortcode/)
 * Étiquettes
 * [block](https://fr.wordpress.org/plugins/tags/block/)[conditional](https://fr.wordpress.org/plugins/tags/conditional/)
   [display](https://fr.wordpress.org/plugins/tags/display/)[schedule](https://fr.wordpress.org/plugins/tags/schedule/)
   [shortcode](https://fr.wordpress.org/plugins/tags/shortcode/)
 *  [Vue avancée](https://fr.wordpress.org/plugins/display-during-conditional-shortcode/advanced/)

## Évaluations

 5 sur 5 étoiles.

 *  [  3 avis à 5 étoiles     ](https://wordpress.org/support/plugin/display-during-conditional-shortcode/reviews/?filter=5)
 *  [  0 avis à 4 étoile     ](https://wordpress.org/support/plugin/display-during-conditional-shortcode/reviews/?filter=4)
 *  [  0 avis à 3 étoile     ](https://wordpress.org/support/plugin/display-during-conditional-shortcode/reviews/?filter=3)
 *  [  0 avis à 2 étoile     ](https://wordpress.org/support/plugin/display-during-conditional-shortcode/reviews/?filter=2)
 *  [  0 avis à 1 étoile     ](https://wordpress.org/support/plugin/display-during-conditional-shortcode/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/display-during-conditional-shortcode/reviews/#new-post)

[Voir tous les avis](https://wordpress.org/support/plugin/display-during-conditional-shortcode/reviews/)

## Contributeurs

 *   [ Gabriel Serafini ](https://profiles.wordpress.org/gserafini/)

## Support

Quelque chose à dire ? Besoin d’aide ?

 [Voir le forum de support](https://wordpress.org/support/plugin/display-during-conditional-shortcode/)

## Faire un don

Souhaitez-vous soutenir l’avancement de cette extension ?

 [ Faire un don à cette extension ](https://sharethepractice.org/plugins/display-during-conditional-shortcode/)