[WordPress] 外掛分享: Blog Time

WordPress 外掛 Blog Time 的封面圖片。

前言介紹

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

外掛協作開發者

coffee2code |

外掛標籤

blog | time | clock | server | datetime |

內容簡介

此外掛會在管理列(所有管理頁面頂部)增加一個動態且實用的時鐘,顯示部落格伺服器的時間。隨著時間的流逝,時鐘會自動更新數字,和數位時鐘一樣。

此外掛也支援靜態模式。在所有管理頁面頂部,會以時間戳記字串的方式呈現,代替動態時鐘。這個靜態管理時間小工具可以被點擊,以就地更新時間(無需重新載入頁面),顯示新的當前伺服器時間。

此外掛也提供「部落格時間」小工具,提供了相同的功能作為管理小工具,不過可以讓你在側邊欄(sidebar)使用。你也可以透過在佈景主題樣板中使用範本標籤 c2c_blog_time() 直接使用此外掛的功能。

注意:對於前端小工具而言,如果勾選了「使用動態時鐘?」的配置選項,此外掛會產生時間戳記而非時鐘。所顯示的時間是當頁面載入時的時間,或者是在小工具上次檢索時間後所顯示的時間。它不會在顯示時自動增加時間。預設情況下,小工具顯示動態時鐘,且會持續增加時間。

這最適合於查看伺服器/部落格時間,以判斷部落格中時效性文章、評論或操作的日期(例如監控何時應該關閉競賽文章的評論等,或僅僅是考慮伺服器所在時區)。或者,當靜態以時間戳記而非時鐘的方式呈現時,它可以指示/保存頁面載入的時間。

鳴謝 Moment.js 提供 JavaScript 日期套件。

連結:外掛首頁 | 外掛目錄頁面 | GitHub | 作者首頁

範本標籤

此外掛提供了一個範本標籤供在佈景主題樣板、functions.php 或其他外掛中使用。

函式


返回並/或顯示網站的格式化時間。

參數

$time_format (string)
選擇性的。PHP 時間格式字串。更多資訊請參考 https://www.php.net/manual/en/datetime.format.php。預設值是 ``(如果沒有修改預設時間格式,則使用 g:i A)。

$echo (bool)
選擇性的。是否輸出模板資訊?預設值是 true。

範例

c2c_blog_time();
?>

$site_date = c2c_blog_time('M d, Y', false);
?>

掛勾

此外掛公開了四個可供掛勾的篩選器。使用這些篩選器的程式碼理想上應該放在 mu-plugin 或專屬外掛(攸關本自述文件範圍之外)。不那麼理想的做法是將其放入使用中佈景主題的 functions.php 中。

c2c_blog_time(filter)

'c2c_blog_time' 鉤子允許您使用另一種方法安全地調用 c2c_blog_time(),這樣,如果外掛被停用或刪除,那麼您對函式的呼叫不會導致網站出現錯誤。

參數:

與 c2c_blog_time() 相同的參數。

原文外掛簡介

This plugin adds a dynamic, functional clock to the admin bar (at top of all admin pages) to show the server time for the blog. The clock automatically updates as time passes, as you would expect of a digital clock.
This plugin also supports a static mode which puts a timestamp string at the top of all admin pages instead of the dynamic clock. This static admin time widget can be clicked to update the time in-place (without a page reload) to show the new current server time.
Also provided is a “Blog Time” widget providing the same functionality as the admin widget, but for your sidebars. You may also utilize the plugin’s functionality directly within a theme template via use of the template tag c2c_blog_time().
NOTE: For the front-end widget, if the “Use dynamic clock?” configuration option is unchecked, this plugin generates a timestamp and NOT a clock. The time being displayed is the time of the page load, or if clicked, the time when the widget last retrieved the time. It won’t actively increment time on the display. By default the widget displays a dynamic clock that does increment time.
This is most useful to see the server/blog time to judge when a time sensitive post, comment, or action would be dated by the blog (i.e. such as monitoring for when to close comments on a contest post, or just accounting for the server being hosted in a different timezone). Or, when used statically as a timestamp and not a clock, it can indicate/preserve when the page was loaded.
Thanks to Moment.js for the JavaScript date handling library.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Template Tags
The plugin provides one template tag for use in your theme templates, functions.php, or plugins.
Functions


Returns and/or displays the formatted time for the site.

Arguments

$time_format (string)
Optional. PHP-style time format string. See https://www.php.net/manual/en/datetime.format.php for more info. Default is ” (which, unless otherwise modified, uses the default time forat: ‘g:i A’).

$echo (bool)
Optional. Echo the template info? Default is true.

Examples

Hooks
The plugin exposes four filters for hooking. Code using these filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain). Less ideally, you could put them in your active theme’s functions.php file.
c2c_blog_time (filter)
The 'c2c_blog_time' hook allows you to use an alternative approach to safely invoke c2c_blog_time() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
Arguments:

same as for c2c_blog_time()

Example:
Instead of:

Do:

c2c_blog_time_format (filter)
The 'c2c_blog_time_format' hook allows you to customize the default format for the blog time. By default this is ‘g:i A’ (though this may be different if modified by localization).
Arguments:

$format (string): The default format for the blog time.

Example:
/**
* Change the default blog time string
*
* @param string $format The default time format.
* @return string
*/
function change_blog_time_format( $format ) {
return 'b, g:i A';
}
add_filter( 'c2c_blog_time_format', 'change_blog_time_format' );

c2c_blog_time_toolbar_widget_for_user (filter)
The c2c_blog_time_toolbar_widget_for_user hook allows you to control if the admin toolbar clock widget should be shown, on a per-user basis. By default the admin toolbar clock is shown to everyone who can see the admin toolbar.
Arguments:

$shown (boolean): Whether the admin toolbar clock widget should be shown. Default of true.

Example:
/**
* Only show the admin toolbar clock for the 'boss' user.
*
* @param $show bool Status of whether the admin toolbar clock should be shown.
* @return bool
*/
function restrict_blog_time_widget_appearance( $show ) {
return 'boss' === get_current_user()->user_login;
}
add_filter( 'c2c_blog_time_toolbar_widget_for_user', 'restrict_blog_time_widget_appearance' );

c2c_blog_time_active_clock (filter)
The 'c2c_blog_time_active_clock' hook returns the boolean value indicating if the Javascript-powered dynamic clock introduced in v2.0 should be enabled or if instead the v1.x era behavior of a static timestamp that can be clicked to update the timestamp via AJAX should be enabled. By default the dynamic clock is enabled.
Arguments:

$allow (boolean): Boolean indicating if the admin widget should be a dynamic clock. Default is true.

Example:
// Disable the dynamic clock and use the static timestamp (whcih can be clicked to update the time via AJAX) instead.
add_filter( 'c2c_blog_time_active_clock', '__return_false' );

各版本下載點

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

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


1.0 | 1.1 | 1.2 | 2.0 | 3.0 | 3.2 | 3.3 | 3.4 | 3.5 | 3.6 | 4.0 | 1.0.1 | 1.0.2 | 3.3.1 | 3.3.2 | 3.5.1 | 3.6.1 | 3.6.2 | 4.0.1 | trunk |

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

  • Display PHP Version 》一個非常輕量且簡單的外掛,可以在「一覽」管理儀表板小工具中顯示目前安裝的 PHP 版本。, 在最新的版本中,你可以在懸停在 PHP 版本文字上時,查看當前的 My...。
  • Media Sync 》您可以掃描所有在uploads目錄中的檔案,並查看哪些檔案實際上在媒體庫中,哪些檔案只是停留在那裡。然後,您可以選擇要將哪些檔案導入數據庫,從而使它們在媒...。
  • WP-ServerInfo 》狀態標誌, , 開發, https://github.com/lesterchan/wp-serverinfo, 翻譯, https://translate.wordpress.org/projects/wp-plugins/wp-serverinfo, 貢獻者, , ...。
  • WP Server Health Stats 》WP Server Health Stats 外掛可以讓你監控 WordPress 網站的核心層級。透過重要的伺服器健康統計資訊,如配置的 PHP 記憶體,記憶體使用量、即時 RAM 使用量...。
  • WP-Memory-Usage 》從1.2.7版開始新增「多重記憶體測量」功能,可多次檢查記憶體使用情況。, 在儀表板和管理頁尾顯示 PHP 版本、記憶體限制和目前的記憶體使用量,現在您可以輕...。
  • Version Info | Show WP, PHP, MySQL & Web Server Versions in Admin Dashboard 》這個外掛會在管理員頁面的頁尾顯示當前的 WordPress 版本號碼以及以下環境資訊:, , 當前的 WordPress 版本資訊,若有更新,會同時顯示當前版本與最新版本, P...。
  • PHP Version 》「PHP版本」是一個非常簡單且輕量的外掛,可幫助您在WordPress儀表板中顯示當前的PHP版本。, 如果您對此外掛感到滿意,請評價它。您的評價將鼓勵我們未來做得...。
  • WP PHP Version Display 》這是一個輕量級的 WordPress 外掛程式,可以在「一覽」管理後台小工具中顯示當前運行的 PHP/MySQL 版本。, 外掛程式僅使用標準的動作和篩選器,不使用 jQuery...。
  • AWEOS PHP Server Info 》WordPress 網站的伺服器資訊, AWEOS PHP Server Info 用於快速獲取重要的伺服器配置概覽。您可以在管理儀表板上直接檢視小工具。, 我們創建了這個工具,以鼓...。
  • WP Discord Post Plus – Supports Unlimited Channels 》WP Discord Post Plus 整合了WordPress和WooCommerce(如果安裝)以將您的新文章和訂單發送到Discord頻道。您可以為您的博客文章或WooCommerce訂單單獨配置多...。
  • Uptime Monitoring for WordPress – My Website is Online 》這個外掛程式讓你能夠透過提供一個設定頁面放置程式碼,更簡單地新增你需要的功能。, 安裝後,會建立一個新的 REST API 路由來輸出程式碼:wp-json/mywebsite...。
  • WP Discord Post 》WP Discord Post 是 WordPress 的一個免費外掛程式,使用 Discord 機器人和 Webhook URL,當新文章在您的網誌上發佈時,可以寫入您所選擇的 Discord 伺服器中...。
  • WP HTTP Compression 》這個外掛可以讓您的 WordPress 網誌在支援壓縮的瀏覽器中以 gzip 格式輸出頁面。, HTTP 壓縮通常會使網頁大小減少 60-80%(對於寬頻用戶),並且下載速度提高...。
  • Memory Usage Bar 》Memory Usage Bar 是一個強大的 WordPress 外掛,讓你能夠顯示當前的記憶體使用量在管理面版的頂部。它非常方便,讓你能夠監控單次訪問的總記憶體使用量。, ...。
  • MySQL version display 》這個外掛會在管理員頁面的頁尾顯示 MySQL 版本號。, 它可以單獨使用,也可以與Server IP & Memory Usage Display 外掛一同使用。, 這個外掛可以做什麼?,...。

文章
Filter
Apply Filters
Mastodon