[WordPress] 外掛分享: Notices API

前言介紹

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

外掛協作開發者

danielbitzer |

外掛標籤

alerts | notices |

內容簡介

這是一個非常簡單的 WordPress 外掛程式,可用於在伺服器端或客戶端創建前端通知。預設有 4 種通知類型:成功、錯誤、警告、一般,或者您可以創建自定義的通知類型。伺服器端的通知存儲在會話中,直到顯示。

這個外掛程式希望有朝一日能解決複雜 WordPress 網站的問題,其中有多個外掛程式,每個外掛程式都有自己的提示,都需要進行樣式設置。

但是現在,對開發人員來說,這個通知 API 是在其佈景主題中創建自定義功能時的有用工具。

伺服器端使用方法

WP_Notices::success( $title, $message, $timer, $priority );
WP_Notices::warning( '登錄失敗', '您輸入了不正確的用戶名或密碼,請重試。');
WP_Notices::error( $title, $message, $timer, $priority );
WP_Notices::general( $title, $message, $timer, $priority );
WP_Notices::custom( $type, $title, $message, $timer, $priority );
?>

客戶端使用方法

jQuery(document).ready(function($){

$.WP_Notices.success( title,message, scroll_to, timer, callback );
$.WP_Notices.error( title, message, scroll_to, timer, callback );
$.WP_Notices.general( title, message, scroll_to, timer, callback );
$.WP_Notices.warning( title, message, scroll_to, timer, callback );

// 自定義類型
$.WP_Notices.render_notice( type, title, message, scroll_to, timer, callback );

// 使用 callback 參數
$.WP_Notices.warning( '表單錯誤', '無效的表單輸入。', false, 3000, function( $notice ) {
console.log( $notice );
});

});

選項

add_filter( 'notice_api_options', 'customize_notice_options' );

function customize_notice_options( $options )
{
$options = array(
'prepend_selector' => '#content',
'container_class' => 'notices-container',
'before_title' => '',
'after_title' => ':
',
'scrolling_speed' => 500,
);
return $options;
}

原文外掛簡介

This is a very simple WordPress plugin for creating frontend notices server side or client side. There are 4 notice types by default success, error, warning, general or you can create custom notice types. Server side notices are stored in the session until displayed.
This plugin hopes to one day solve the problem of complex WordPress sites with multiple plugins all having their own Notices that all require styling.
But for now, the Notices API is useful tool for developers creating custom functionality in their theme.
Server Side Usage

Client Side Usage
jQuery(document).ready(function($){

$.WP_Notices.success( title,message, scroll_to, timer, callback );
$.WP_Notices.error( title, message, scroll_to, timer, callback );
$.WP_Notices.general( title, message, scroll_to, timer, callback );
$.WP_Notices.warning( title, message, scroll_to, timer, callback );

// Custom type
$.WP_Notices.render_notice( type, title, message, scroll_to, timer, callback );

// Using the callback parameter
$.WP_Notices.warning( 'Form Error', 'Invalid form input.', false, 3000, function( $notice ) {
console.log( $notice );
});

});

Options
add_filter( 'notice_api_options', 'customize_notice_options' );

function customize_notice_options( $options )
{
$options = array(
'prepend_selector' => '#content',
'container_class' => 'notices-container',
'before_title' => '',
'after_title' => ':
',
'scrolling_speed' => 500,
);
return $options;
}

各版本下載點

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

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


1.0.0 |

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

  • Scheduled Announcements Widget 》預定公告小工具讓您可以在網站的任何小工具區域或您的佈景主題檔案中,新增一個滾動的網站公告清單,與一般文章和頁面無關。這對於公佈事件、警示或通知非常...。
  • Notification Master – All-in-One WordPress Notifications 》## 摘要, Notification Master 是一個多功能的 WordPress 外掛,旨在通過提供全面的通知系統來提升使用者參與度。不論您希望通知用戶有關新文章、評論、使用...。
  • Advanced Notifications 》Advanced Notifications 允許您建立漂亮的自定義通知,顯示在您選擇的頁面或文章上。, Demo – Advanced Notifications – 在線預覽, 正在開發中:...。
  • Super Monitoring 》Super Monitoring是一個外部的網站監控應用程式,用於監控網站的運作時間和其基本功能。, 此外掛會將Super Monitoring介面整合到WordPress管理面板中,因此您...。
  • World Weather 》World Weather 是一個WordPress外掛,可讓您收集免費或付費的氣象供應商數據,並在網站內容(例如頁面和文章)及元件中顯示這些數據。, 第三方服務, 目前已實...。
  • MaxBoxy: Make WordPress Floating Content, Popup, Alert Bar 》MaxBoxy 是一款能夠協助您在網站中製作互動及轉換元素的工具。具體而言,在 WordPress 上使用 MaxBoxy 可以製作浮動內容、選單、資訊欄、彈出式或滑動式面板...。
  • Sales Notifications for WooCommerce – Recent Sales Popup 》Live Sale Notification For Woocommerce 是增加銷售量的最佳 WooCommerce 外掛程式。這個外掛允許您在彈出視窗上顯示最近的訂單並顯示顧客與產品資訊,您可...。
  • Callout Boxes 》此外掛包含一個呼叫框(callout box),裡面包含一個圖示以及文章內容。此外掛使用 Heroicons 和 php-heroicons PHP 套件。, 圖示, 呼叫框包含一個圖示,用以...。
  • WP-Announcements 》WP-Announcements 外掛適用於需要在網站或部落格顯示全站公告、精選文章、重要消息、社群通知、廣告、問卷或郵件訂閱表單、緊急警示或其他任何可以作為跑馬燈...。
  • AlertsDLX – Alerts, Callouts, and Notifications 》AlertsDLX 提供漂亮的樣式化警示和通知,適用於區塊編輯器。, , 快速連結:, , AlertsDLX 主頁, AlertsDLX 說明文件, AlertsDLX 支援, , 區塊風格的靈感來自...。
  • Courier Notices 》在您的網站上添加可取消和不可取消的通知。, , 自定義 Courier Notices 使用的顏色和圖標,無需編碼, 在需要時添加新的“類型”通知, 附帶一個常用的有用通知庫...。
  • Email Login Attempts 》這個外掛會在有人透過 WordPress 登入頁面嘗試登入時,自動發送一封電子郵件。, 待辦事項, , 新增管理員頁面, 指定收件人電子郵件地址, 辨別登入失敗或成功的...。
  • StatusCake 》StatusCake 是一個網站運行時間監控和警報服務。StatusCake 是您 WordPress 網站的理想夥伴,它具有豐富的運行時間監控、域名監控、 SSL 監控等功能。, 此外...。
  • WPNotify – Notifications for WooCommerce 》您有一個每天有數百位買家的出色電子商務業務嗎?需要透過 WhatsApp 與您的用戶建立更緊密的聯繫嗎?您來對地方了。, 安裝插件,開始通過 WhatsApp 發送有關...。
  • WPGAlerts 》WPGAlerts 允許您將自訂 Google Alert 文章添加到您的 WordPress 網站,最多可顯示 20 篇文章,包括作者、內容和標題連結到完整的文章。WPGAlerts 是將當前和...。

文章
Filter
Apply Filters
Mastodon