[WordPress] 外掛分享: Localize Time

前言介紹

  • 這款 WordPress 外掛「Localize Time」是 2014-05-29 上架。
  • 目前有 50 個安裝啟用數。
  • 上一次更新是 2014-05-30,距離現在已有 3992 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.0.1 以上版本才可以安裝。
  • 有 3 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

jbchristy |

外掛標籤

time | timezone | local time |

內容簡介

這個 WordPress 外掛加入了 [localize_time] 短代碼。這個短代碼允許作者輸入任何時區的日期和時間。短代碼顯示帶時區的原始時間,接著顯示符合使用者地區設置的相同時間,這對於宣布現場活動(例如線上直播活動)給分散在不同地區的觀眾非常有用。

需要顯示的日期和時間是輸入在短代碼的內容,即位於 [localize_time] 和 [/localize_time] 標籤之間。時間可以使用幾乎任何可識別為日期和時間的格式來指定。

短代碼可以使用以下選項:

tz - 短代碼的內容所在的時區。如果省略此選項,則預設為網站的時區。時區使用任何可被 PHP 的 DateTimeZone 辨識的格式來指定。在此處查看完整的時區文檔。
fmt - 指定如何顯示原始時間的格式字符串。如果省略,則預設為網站的日期格式,接著是網站的時間格式,最後是時區。如果要精確輸出原始時間(帶時區),請指定 fmt="orig"。或者,您可以輸入使用 WordPress 通用設置選項上使用的相同代碼的格式字符串。在此處查看有關日期/時間格式字符串的完整文檔。
before_local - 本地時間之前的字符串。預設為 ‘ (
after_local - 本地時間之後的字符串。預設為 ‘)

範例

以下是使用短代碼的範例。這些範例中,網站的時區設置為美國/紐約(EST-5EDT),而使用者的時區為美國/洛杉磯(PST-8PDT)。

當地時間與原始時間不在同一年與月份:
[localize_time]1/1/2014 1:00 am[/localize_time]
輸出:
January 1, 2014 1:00 am EST (12/31/2013, 10:00:00 PM PST)

指定一個與網站時區不同的時區:
[localize_time tz=”Europe/Paris” ]July 14, 2014 19:00[/localize_time]
輸出:
July 14, 2014 7:00 pm CEST (7/14/2014, 10:00:00 AM PDT)

指定原始時間的格式:
[localize_time fmt=”m/d/Y g:i A T”]June 14, 2014 6:30 AM[/localize_time]
輸出:
06/14/2014 6:30 AM EDT (6/14/2014, 3:30:00 AM PDT)

指定一個與使用者相同時區的時間:
[localize_time tz=”PST”]3pm Nov. 1, 2014[/localize_time]
輸出:
November 1, 2014 3:00 pm PDT

注意:本地時間的顯示因時區和瀏覽器而異。

原文外掛簡介

This WordPress plugin adds the [localize_time] shortcode. The shortcode allows an author
to enter a date and time in any timezone. The shortcode displays the original time with
timezone, followed by the same time in the user’s timezone, formatted correctly for the
user’s locale. This is useful for announcing live events, e.g. a live online streaming
event, to widely dispersed audiences.
The date and time to be displayed are entered as the shortcode’s content, i.e. between the
[localize_time] and [/localize_time] tags. The time can be specified in almost
any format that’s recognizable as a date and time.
The shortcode takes the following options:

tz – the timezone the shortcode’s content is in. If this option is omitted, it defaults
to the site’s timezone. Timezones are specified in any format recognized by
PHP’s DateTimeZone.
fmt – a format string specifying how the original time should be displayed. If omitted,
it defaults to the site’s date format followed by the site’s time format followed by the
timezone. To output the original time exactly as entered (with the timezone), specify
fmt="orig". Or you can enter a format string using the same codes that are used on
WordPress’s General Settings tab. See
full documentation on date / time format strings here.
before_local – the string to precede the local time. Defaults to ‘ (‘
after_local – the string to follow the local time. Defaults to ‘)’

Examples
Below are examples of using the shortcode. For these examples, the site’s timezone is set to America/New_York (EST-5EDT) and the user is in the America/Los_Angeles (PST-8PDT) timezone.

Local time is in a different year and month from original time:
[localize_time]1/1/2014 1:00 am[/localize_time]
outputs:
January 1, 2014 1:00 am EST (12/31/2013, 10:00:00 PM PST)

Specify a time in timezone different from the site’s:
[localize_time tz=”Europe/Paris” ]July 14, 2014 19:00[/localize_time]
outputs:
July 14, 2014 7:00 pm CEST (7/14/2014, 10:00:00 AM PDT)

Specify a format for the original time:
[localize_time fmt=”m/d/Y g:i A T”]June 14, 2014 6:30 AM[/localize_time]
outputs:
06/14/2014 6:30 AM EDT (6/14/2014, 3:30:00 AM PDT)

Specify a time in the same timezone as the user:
[localize_time tz=”PST”]3pm Nov. 1, 2014[/localize_time]
outputs:
November 1, 2014 3:00 pm PDT

Note that the display of the local time varies by timezone and browser.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Localize Time」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.0 | trunk |

延伸相關外掛(你可能也想知道)

  • Date and Time Widget 》這個「日期及時間小工具」讓您可以在側邊欄中加入一個小工具,顯示當地日期和/或時間。, 特色, , 可以選擇日期和時間的格式。, 自訂字型、字型大小、文字顏色...。
  • IP2Location World Clock 》這是一個簡單的小工具,可以在你的網站上顯示類比或數字時鐘,而不需要太多麻煩。IP2Location 世界時鐘提供了一系列不同的時鐘設計,完全免費。它支援本地時...。
  • Connections Business Directory Local Time 》Connections 商業目錄當地時間擴充功能是一個結合了優秀的 jClocksGMT 世界時鐘外掛程式 後重新設計,專門為 Connections 商業目錄所設計的。, 它是如何運作...。
  • User Local Date and Time 》這個外掛將提供一個簡單的短代碼,允許您顯示訪客當前的日期和時間。適用於標準時間和阿拉伯時間。, 您可以使用 arabictime、bgtime 和 standardtime 這些 cl...。
  • Local Time 》這是一個基於 JS 的本地時間外掛,可以透過 [melt_localtime] 簡碼在任何頁面或文章中顯示。, 使用簡碼 **[melt_localtime]** 帶有以下屬性 :, , 文字(text),...。

文章
Filter
Apply Filters
Mastodon