前言介紹
- 這款 WordPress 外掛「WP Shortcode Shield」是 2012-04-24 上架。
- 目前有 10 個安裝啟用數。
- 上一次更新是 2012-11-12,距離現在已有 4556 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.4 以上版本才可以安裝。
- 有 1 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
vicchi |
外掛標籤
page | post | shortcode | documentation |
內容簡介
這個外掛允許您在文章和頁面的內容中引用 WordPress 短碼,而不會被 WordPress 自動擴展短碼。該插件利用了 WordPress 短碼 API 不支援嵌套短碼的特性,使得該外掛的短碼可以包含正在記錄的短碼。
短碼解析器對文章內容進行一次單獨的處理。這意味著如果短碼處理程序的$content參數包含另一個短碼,它將不會被解析。
該外掛支援自結束的[shortcode]和包圍[shortcode]content[/shortcode]形式,支援短碼的短名[wp_scs]和詳細的[wp_shortcode_shield]形式。為了簡潔起見,本文檔剩下的部分將使用[wp_scs]短名。
如果使用短碼自結束的形式,你需要使用code屬性並指定你想要記錄的短碼名稱,但不要使用包圍的[和]字符。這是因為在解析短碼時,WordPress會查找第一個出現的' ] '字符來結束短碼。由於這個原因,像這樣的用法:
[wp_scs code="[another-shortcode-name]"]
…WordPress將使用code屬性中的" ] "字符來嘗試結束短碼名稱,這並不是所期望的。因此,該外掛自動向外輸出添加終止的"[ ]"字符,所以像這樣的用法:
[wp_scs code="another-shortcode-name"]
…將在文章或頁面的內容中顯示 [another-shortcode-name]。
如果使用囊括的形式,可以使用包括或不包括'['和']'字符的短碼文本。如果省略了它們,插件將自動為您添加它們,以使像這樣的用法:
[wp_scs][another-shortcode-name][/wp_scs]
…和
[wp_scs]another-shortcode-name[/wp_scs]
…會顯示相同的結果,即[another-shortcode-name]。
最後,需要注意,不能在同一文章或頁面中混用插件短碼的囊括形式和自結束形式,這不是插件的限制,而是 WordPress 實現短碼 API 的方式…。
解析器不能處理相同短碼的囊括形式和非囊括形式的混用。例如,如果你有:
[myshortcode example='non-enclosing' /] non-enclosed content [myshortcode] enclosed content[/myshortcode]
解析器不會把它視為由文本"non-enclosed content"分隔的兩個短碼,而是把它解析為一個囊括'non-enclosed content [myshortcode] enclosed content'的單個短碼。
原文外掛簡介
This plugin allows you to refer to a WordPress shortcode within the content of posts and pages without that shortcode being automagically expanded by WordPress. The plugin takes advantage of the fact that the WordPress ShortCode API does not support nested shortcodes to allow this plugin’s shortcode to wrap the shortcode being documented.
The shortcode parser uses a single pass on the post content. This means that if
the $content parameter of a shortcode handler contains another shortcode, it won’t
be parsed
The plugin supports both the self closing [shortcode] and enclosing [shortcode]content[/shortcode] forms and supports a short form name of the shortcode, [wp_scs] as well as the more verbose [wp_shortcode_shield] form. For the sake of brevity, the remainder of this documentation will use the [wp_scs] short form name.
If using the self-closing form of the shortcode, you need to supply the name of the shortcode you are documenting using the code attribute but without using the enclosing [ and ] characters. This is because when parsing shortcodes, WordPress looks for the first occurrence of the ‘]’ character to terminate the shortcode. As a result of this, usage such as
[wp_scs code="[another-shortcode-name]"]
… WordPress will use the ‘]’ character inside the code attribute to try and terminate the shortcode name, which is not what is desired. Instead, the plugin automagically adds the terminating ‘[‘ and ‘]’ characters to the plugin’s output, so that usage such as
[wp_scs code="another-shortcode-name"]
… will display [another-shortcode-name] in your post’s of page’s content.
If you are using the enclosing form of the shortcode, you can either supply the shortcode to be documented with or without enclosing ‘[‘ and ‘]’ characters; if they are omitted, the plugin will add them for you, so that usage such as
[wp_scs][another-shortcode-name][/wp_scs]
… and
[wp_scs]another-shortcode-name[/wp_scs]
… will display the same results, namely [another-shortcode-name].
Finally a note of caution, you cannot mix the enclosing and self closing form of the plugin’s shortcode within the same post or page; this is not a limitation of the plugin, but the way in which WordPress implements the ShortCode API …
The parser does not handle mixing of enclosing and non-enclosing forms of the same
shortcode as you would want it to. For example, if you have:
[myshortcode example='non-enclosing' /] non-enclosed content [myshortcode] enclosed content
[/myshortcode]
Instead of being treated as two shortcodes separated by the text ” non-enclosed content “,
the parser treats this as a single shortcode enclosing ” non-enclosed content [myshortcode]
enclosed content”.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WP Shortcode Shield」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
Simple Page Ordering 》這個外掛可以用簡單的拖放操作,讓您對頁面、樹狀自訂文章類型或是擁有「頁面屬性」的自訂文章類型進行排序,只需要使用內建的頁面列表就能完成。, 只要簡單...。
PS Auto Sitemap 》PS Auto Sitemap 是一個 WordPress 外掛,自動從您的 WordPress 網站生成網站地圖頁面。, 對於初學者來說,安裝非常容易;對於專家來說,定制也非常容易。您...。
Post Type Switcher 》這個外掛在文章編輯介面中新增了一個簡單的文章型別下拉選單,讓你可以重新指派任何文章至新的文章型別。你可以在編輯文章時更換文章的型別。, 支援的型別, ...。
Page Links To 》這個外掛可以讓你將 WordPress 的頁面(或文章或自訂文章類型)連結至你選擇的 URL,而非 WordPress 的 URL。此外,它還會將前往舊的 URL(或「正常」的 URL...。
Display Posts – Easy lists, grids, navigation, and more 》Display Posts 讓您輕鬆地列出網站上的所有內容。首先在內容編輯器中新增此短碼,以列出最近的文章清單:, [display-posts], , 按類別篩選, 若只想顯示特定類...。
Page and Post Clone 》這個外掛可以透過一個按鈕來複製貼文或頁面,現在您不必從零開始進行新頁面或貼文的樣式設計。, 這個外掛的主要功能包括:, , 建立一個頁面複本,保留所有內...。
amr shortcode any widget 》使用shortcode將小工具或多個小工具或整個小工具區域(側邊欄)插入到頁面中。, 首先在正常的側邊欄中設置小工具。 檢查它是否正常運作。, 然後將所選小工具...。
WP Page Widget 》這款外掛讓小工具的選擇變得更加容易。啟用此外掛後,我們可以選擇要顯示在特定頁面/文章/自訂文章類型中的小工具。, 請注意,使用此外掛時必須啟用側邊欄主題。。
Pages with category and tag 》在頁面中新增分類和標籤。。
CMS Tree Page View 》將所有頁面和自訂文章以 CMS 樹狀概覽方式添加到 WordPress,類似於專注於頁面的 CMS 中經常找到的檢視方式。, 如果您的目標是將多個內容類型合併到單一檢視...。
WP Total Hacks 》WP Total Hacks 可以在您的 WordPress 網站上自訂超過 20 個設置。, 此外掛已在 GitHub 上發布。, 一些功能:, 您可以選擇啟用或停用所有項目。, 需要 PHP5!...。
Reveal IDs 》WordPress 2.5版本發佈後,所有管理頁面的ID都被刪除了。這應該是因為普通用戶不需要它們。但對於高級WordPress用戶和開發人員來說,這些ID對某些外掛或模板...。
WP Admin UI Customize 》, 儀表板, 顯示選項標籤, 輸出 - 元網站, 管理工具列 (Toolbar), 側邊選單 (Side menu), 元箱的管理, 登入畫面, 其他功能, , 這些自訂化都是可以實現的。, , ...。
VK Link Target Controller 》外掛介紹, VK Link Target Controller 外掛可在最近文章列表或存檔頁面中,讓使用者點選文章標題時轉址到其他網頁而非文章內容頁面。, 使用範例, 假設你在 eB...。
Sitemap 》此程式碼已經移至Page-list plugin。請刪除原先的Sitemap外掛程式,並改為安裝Page-list plugin。不用擔心,這兩個外掛程式的功能是相同的。, , 高級 iFrame ...。