[WordPress] 外掛分享: Visual Shortcodes

首頁外掛目錄 › Visual Shortcodes
100+
安裝啟用
★★☆☆☆
2.5/5 分(2 則評價)
4815 天前
最後更新
問題解決
WordPress 3.2.1+ v0.1 上架:2011-08-17

內容簡介

這是一個實用的外掛程式,能夠讓其他外掛和主題使用自訂圖片替換短代碼,就像 WordPress 原生的相冊短代碼所做的那樣。用戶可以點擊替換的圖片來顯示「刪除」按鈕。

當您的短代碼已經具有 tinymce 按鈕時,此外掛程式運作效果非常出色,但對於手動短代碼也同樣適用。

此外掛程式不支援多行短代碼或非自結束短代碼(例如,支援 [foo bar="baz"] 但不支援 [foo]bar baz[/foo])。誠實地說,我甚至不知道如果您嘗試使用這種格式會發生什麼。它可能會運作,但完全不支援。

若要添加短代碼,請在篩選器 'jpb_visual_shortcodes' 上掛鉤。篩選器會將一個數組作為引數傳遞。該數組的每個元素都是一個關聯數組,必須包含以下鍵的值:

shortcode 替換的短代碼名稱
image 替換短代碼的圖片 URL。

此外,該數組可能包含選填參數command,必須是有效的 tinymce 命令。若有此值,將在用戶單擊替換圖片時觸發第二個 UI 按鈕(「編輯」),單擊此按鈕時會執行傳遞的 tinymce 命令。

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.1) 或搜尋安裝

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

原文外掛簡介

This is a utility plugin that will allow other plugins and themes to swap out shortcodes with custom images, in the same way that WordPress’ native gallery shortcode does this. Replacement images can be clicked to reveal a ‘delete’ button.
This works extremely well when your shortcode already has a tinymce button, but does work for manual shortcodes too.
This plugin does not support multi-line shortcodes or non-self-closing shortcodes (e.g. it supports [foo bar="baz"] but not [foo]bar baz[/foo]). Honestly, I don’t even know what would happen if you tried to use one. It may work, but it’s entirely unsupported.
To add your shortcode, hook onto the filter 'jpb_visual_shortcodes'. That filter will pass one array as an argument. Each element of that array is an associative array which must contain values for the following keys:

shortcode The name of the shortcode to replace
image The url of the image to replace the shortcode with.

Additionally, the array may contain the optional parameter command, which must be a valid tinymce command. If present, this value will trigger a second UI button (‘Edit’) when the user clicks the replacement image which, when clicked, will execute the tinymce command passed as the value.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon