[WordPress] 外掛分享: Display During Conditional Shortcode

首頁外掛目錄 › Display During Conditional Shortcode
WordPress 外掛 Display During Conditional Shortcode 的封面圖片
200+
安裝啟用
★★★★★
5/5 分(3 則評價)
39 天前
最後更新
問題解決
WordPress 6.1+ PHP 7.0+ v2.0 上架:2013-03-07

內容簡介

輸入開始和結束日期/時間,您希望短碼內容在期間內顯示。選擇性地包括一個訊息或不同的內容,以便時間過去後顯示。

短碼:

將[display_during end_day_time="June 27, 2018 10:00 am" message="抱歉,這個內容已不再提供。"]CONTENT_TO_DISPLAY[/display_during]插入到任何文章或頁面中,以有條件地顯示短碼內的內容。如果開始和結束時間參數不是當前有效的,則顯示您指定的message參數。

所有短碼參數:

[display_during start_day_time="Sun 8:00 am" end_day_time="Mon 8:00 pm" timezone_location="America/Denver" message="抱歉,此內容目前不可用。"]CONTENT_TO_DISPLAY[/display_during]

start_day_time ─ 選擇性 ─ 內容應該從哪一天/時開始顯示?
end_day_time ─ 必需 ─ 短碼內容什麼時間應該停止顯示?
timezone_location ─ 選擇性 ─ 時區默認使用在「設定 > 一般」中設置的內容。您可以使用這個選擇性參數來指定不同的時區位置。使用標準的PHP時區

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Display During Conditional Shortcode」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

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

Date Range – Show content between specific start and end dates
Recurring – Show content on specific days of the week during a time window
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)

延伸相關外掛

文章
Filter
Apply Filters
Mastodon