[WordPress] 外掛分享: Global Bootstrap Banner

首頁外掛目錄 › Global Bootstrap Banner
WordPress 外掛 Global Bootstrap Banner 的封面圖片
10+
安裝啟用
尚無評分
2159 天前
最後更新
問題解決
WordPress 5.0+ PHP 5.2.4+ v1.0 上架:2020-04-20

內容簡介

這是一款 WordPress 自訂小工具,可以添加全域網站橫幅,並使用 Bootstrap 警告框進行樣式設計。

外掛假定您已經在使用 Bootstrap,因此需單獨加載 Bootstrap 的 JavaScript 與 CSS。

安裝後,您可以使用 global_bootstrap_banner() 函数在正確的位置(例如,在 header.php 中)添加警告框。

例如:
if (function_exists('global_bootstrap_banner')){
echo global_bootstrap_banner();
}

如果您喜歡,也可以使用短代碼代替:
[global-bootstrap-banner]

短代碼選項:
此外掛最好在使用自訂器界面時運作。但如果您願意,您可以使用短代碼和覆蓋大部分的欄位。

enabled(預設值true):是否顯示橫幅。
colour(預設值alert-primary):用於樣式警告框的 Bootstrap 類別。
header_text:標題-留空以跳過警告標題。
body_text:警告的主要文字。您可以使用 HTML。
link_text:警告底部按鈕的顯示文字。留空以跳過。
link_url:按鈕鏈接的 URL。
link_class(預設值btn-primary):用於樣式按鈕的 Bootstrap 類別。
link_new_window(預設值false):是否在新窗口中打開連結。
link_btn_lg(預設值false):是否使用 btn-lg 類別(大按鈕)。
link_btn_sm(預設值false):是否使用 btn-sm 類別(小按鈕)。
link_btn_block(預設值false):是否使用 btn-block 類別(全寬按鈕)。
dismiss_btn(預設值true):是否在警告框角落顯示關閉按鈕。
dismiss_expiry(預設值14):多少天後 Cookie 失效,再次顯示警告框。
dismiss_id:用於停用 Cookie 的隨機字符串。使用新字符串可強制將警告框顯示給所有人。
alert_before(預設值<div class="global-bootstrap-banner container">):警告框之前使用的 HTML。
alert_after(預設值</div>):警告框之後使用的 HTML。
header_

外掛標籤

開發者團隊

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

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

原文外掛簡介

A WordPress Customise Widget to add a global website banner, styled using a Bootstrap alert box.
The plugin assumes that you’re already using Bootstrap, so you need to load the Bootstrap javascript and CSS separately.

Download Twitter Bootstrap
Bootstrap CDN (directly link CSS and javascript files)
Bootstrap Alerts in action

Once installed, you can add the alert to the correct location in your theme (for example, in header.php with the global_bootstrap_banner() function.
For example:
if (function_exists('global_bootstrap_banner')){
echo global_bootstrap_banner();
}

If you prefer, you can use a shortcode instead:
[global-bootstrap-banner]

Shortcode Options
The plugin works best when using the Customizer interface. However, if you wish you can use a shortcode and override most fields.

enabled (default true)

Whether to show the banner or not.

colour (default alert-primary)

Bootstrap class to use for styling the alert.

header_text

Header – leave blank to skip the alert header.

body_text

Main text for the alert. You can use HTML.

link_text

Display text for a button at the bottom of the alert. Leave blank to skip.

link_url

URL for button to link to.

link_class (default btn-primary)

Bootstrap class to use for styling the button.

link_new_window (default false)

Whether to open the link in a new window or not.

link_btn_lg (default false)

Use the btn-lg class for the button (big button).

link_btn_sm (default false)

Use the btn-sm class for the button (small button).

link_btn_block (default false)

Use the btn-block class for the button (full width button).

dismiss_btn (default true)

Whether to show a dismiss button in the corner of the alert.

dismiss_expiry (default 14)

How many days the dismissal cookie should last for before it is shown again.

dismiss_id

Random string to use for the dismissal cookie. Use a new one to force it to show for everyone.

alert_before (default

)

HTML to use before the alert.

alert_after (default

)

HTML to use after the alert.

header_before (default

)

HTML to use before the heading.

header_after (default

)

HTML to use after the heading.

link_before (default

)

HTML to use before the button.

link_after (default

)

HTML to use after the button.

For example, a simple shortcode usage would be:
[global-bootstrap-banner body_text="This alert says something different"]

Note that the shortcode first takes the settings from the Customizer and then overwrites these.
So the above shortcode would show a header if it is set in the Customizer settings.
Credits
This plugin was written by @ewels.
Contributing
If you would like to contribute to this plugin, please go to the GitHub repository and make a personal fork of the development version. You can then make your changes and submit a pull request. I will happily review the code and then merge when we’re both happy.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon