[WordPress] 外掛分享: Log Out Shortcode

首頁外掛目錄 › Log Out Shortcode
3,000+
安裝啟用
★★★★★
5/5 分(12 則評價)
609 天前
最後更新
問題解決
WordPress 6.0+ v1.1.1 上架:2014-08-02

內容簡介

這個外掛有三個短碼:

[logout] - 標準的登出鏈接,在登出後用戶仍然停留在登錄頁面上。
[logout_to_home] - 登出鏈接,登出後重定向到您的首頁。
[logout_to_current] - 登出鏈接,登出後重定向回當前頁面/URL。

進階用法:

所有三個短碼都支援 3 個屬性/參數:

[logout text="" class="" redirect=""]

支援的三個屬性/參數如下:

text=""

– 用於鏈接錨文本的文字。
– 預設值:Log Out
class=””
– 用於鏈接的 HTML 類名。多個類名應該用空格分開。
– 預設值:logout
redirect=””
– 用戶在登出後要重定向的路徑/URL。
– 預設值:WordPress 登錄頁面。
– 注意:必須是與 WordPress 網站相同域名的 URL 或路徑(不能是外部域名/URL)。

一些範例:
[logout text=”Log Off”] – 一個名為 Log Off 的登出鏈接。
[logout redirect=”/members/”] – 登出之後,將用戶重定向到/members/。
[logout_to_home text=”Log Off”] – 一個名為 Log Off 的登出鏈接,登出後重定向到您的首頁。
[logout class=”log-out-link”] – 為登出鏈接使用自定義的 CSS/HTML 類名稱。

注意:如果用戶未登錄,短碼將返回空/無內容。

這個外掛的靈感來自 Ben Poland 的 Logout Button 外掛。

如果您喜歡,可以在 GitHub 為這個外掛做貢獻。

外掛標籤

開發者團隊

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

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

原文外掛簡介

There are 3 shortcodes that can be used:
[logout] - A standard Log Out link, where the user stays on the login screen after being logged out.
[logout_to_home] - A link that logs the user out, and redirects them to your home page.
[logout_to_current] - A link that logs the user out, and redirects them back to the current page/URL.

Advanced Usage:
All 3 shortcodes all support 3 attributes/parameters:
[logout text="" class="" redirect=""]

The 3 supported attributes/parameters are:
text=""

– The text to use for the link anchor text.
– Default: Log Out
class=””
– The HTML class(es) to use for the link. Multiple classes should be separated by a space.
– Default: logout
redirect=””
– The path/URL to redirect the user to after they are logged out.
– Default: the WordPress login screen.
– Note: must be a URL or path on the same domain name as the WordPress website (cannot be an external domain/URL)
Some Examples:
[logout text=”Log Off”] – A Log Off link that logs the user out.
[logout redirect=”/members/”] – Log the user out, and redirect them to /members/.
[logout_to_home text=”Log Off”] – A Log Off link that logs the user out and redirects them to your home page.
[logout class=”log-out-link”] – Use a custom CSS/HTML class name for the log out link.
Note: the shortcodes will return nothing/empty if the user isn’t logged in.
This plugin is inspired by the Logout Button plugin by Ben Poland.
If you like, you can contribute to this plugin on GitHub.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon