[WordPress] 外掛分享: Shortcode Callback

WordPress 外掛 Shortcode Callback 的封面圖片。

前言介紹

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

外掛協作開發者

digitalpoint |

外掛標籤

php | bbcode | callback | shortcode | short code |

內容簡介

「Shortcode Callback」這個外掛允許您在使用 shortcode 的地方執行任意的 PHP 代碼,只要使用 [callback] shortcode 即可。

用法如下:

使用以下 shortcode 執行 someFunction(),並插入其回傳結果:
[callback function=”someFunction”]

範例:使用以下 shortcode 包含一個 PHP 檔案(路徑相對於 WordPress 的 ABSPATH),然後在使用 shortcode 的地方插入執行 someFunction() 的結果:
[callback include=”custom/filetoinclude.php” function=”someFunction”]

範例:使用以下 shortcode 包含一個 PHP 檔案(路徑相對於 WordPress 的 ABSPATH),然後向 someFunction() 傳遞一個參數,在使用 shortcode 的地方回傳結果:
[callback function=”someFunction” include=”custom/filetoinclude.php” param=”something”]

使用該外掛呼叫類別/方法的格式與上面完全相同,只需在 shortcode 的「function」屬性中指定「class::method」即可。
[callback function=”someClass::someFunction” include=”custom/filetoinclude.php” param=”something”]

這裡有一個範例(並含有 PHP 代碼)。

原文外掛簡介

The Shortcode Callback plugin allows you to use a [callback] shortcode to execute arbitrary PHP code wherever the shortcode is used.
Usage
Execute someFunction() and insert whatever it returns with the following shortcode:
[callback function=”someFunction”]
Example shortcode to include a PHP file (the path is relative to WordPress’ ABSPATH), then insert the results of someFunction() where you used the shortcode:
[callback include=”custom/filetoinclude.php” function=”someFunction”]
Shortcode example that includes a PHP file (the path is relative to WordPress’ ABSPATH), then passes a paramter to someFunction() and returns the results where you used the shortcode:
[callback function=”someFunction” include=”custom/filetoinclude.php” param=”something”]
The format to call a class/method with the shortcode is exactly the same as above, except you specify the class::method in the “function” attribute of the shortcode.
[callback function=”someClass::someFunction” include=”custom/filetoinclude.php” param=”something”]
There is an example (with PHP code) over here.

各版本下載點

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

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


1.0.0 | trunk |

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

  • Code Widget 》Code Widget 是一個簡單的小工具,允許您插入任意的文字/HTML,執行 PHP 程式碼或 Short Code。此小工具解析 PHP 程式碼為簡單文字等等。, 只有擁有未過濾的 ...。
  • URL ShortCodes 》有時候您想在內容編輯器中加入基本網址(博客的網址或活動模板的網址),但模板自訂可能不夠靈活。, 透過這個外掛,您可以使用 [url_base] 輸出博客的基本網...。
  • Custom Menu Shortcode 》這個外掛允許您在頁面、文章或其他自訂文章類型中使用簡單的短碼來顯示您的 WordPress 自定義選單。。
  • List Child Pages Shortcode 》我找不到一個簡單的外掛程式,能夠啟用一個短碼,可以在父頁面下發佈子頁面的列表。所以,我自己開發了一個。, 用法:, 範例1:按發佈日期倒序排序子頁面:, ...。
  • Snippy 》使用 Snippy 快速創建自己的自定義短碼。, Snippy 短碼由各種“比特”組合而成。一個“比特”可以是一個文件,比如樣式表或腳本,也可以是一段代碼,比如 HTML、C...。
  • Uix Shortcodes 》Uix Shortcodes讓您輕鬆快速地添加所需的短碼,以實現您所需的頁面佈局或功能。它提供了易於使用的26個短碼。這些內容元素是任何頁面構建器的核心。這些是隨...。
  • WP Google Maps Shortcode 》WP Google Maps Shortcode – 使用縮短碼在您的文章或頁面中插入 Google 地圖。, 地圖使用 [wp_gmaps] 縮短碼顯示:, [wp_gmaps address="加州舊金山" z...。
  • WP Exit Page Redirect 》這個 WordPress 外掛可以輕鬆地在文章或頁面加入一個短碼,產生一個離開頁面 meta tag 轉向,當訪客造訪該頁面時,會自動被導向特定網站。這是製作離開警告頁...。
  • bbPress – Do Short Codes 》這個 bbPress 的外掛非常簡單,只有一個功能:解析放置在主題和回覆內容中的短代碼。, bbPress 預設不會渲染放置在論壇文章中的短代碼,這個外掛啟用了短代碼...。
  • Plugin Name: Disable Media 》這個外掛可以啟用 WordPress 側邊欄小工具中的短碼。預設情況下,WordPress 不支援側邊欄小工具中的短碼。此外掛可以解除此限制。, 只需使用文字小工具(Text...。
  • Materializer WP 》開始使用, 感謝您的安裝!讓我來介紹一下:, 文件:, , 所有文件都可以在文件頁面找到, , 快速啟動, Materializer 配備了超過 25 种不同的 Material Design ...。
  • authorSTREAM 》此外掛可協助您輕鬆地在 WordPress 文章中嵌入不同的簡報格式,例如 PowerPoint 檔案、Apple Keynotes 或 Adobe PDF 檔案,插入的簡報即使用 authorSTREAM 的...。
  • End Page Slide Box 》End Page Slide Box 是一個 WordPress 外掛,當你滾動頁面到文章底部時,會出現一個元素觸發 Slide Box 出現,並顯示相關的文章。, 相關連結: 作者網站。
  • WP Sidebar Essential 》一般的文字小工具允許您插入任意的文字和/或 HTML 代碼。, 這個外掛也提供同樣的功能,但還支援解析和執行任何插入的 Shortcode 和 PHP 代碼。, 所有的 Short...。
  • Simple Promo Code 》此外掛允許編輯者向使用者索取促銷代碼及選擇性的電子郵件地址,以取得文件存取權並追蹤其使用情況。, 編輯者功能, , 提供短碼 [promo],可以顯示一個表單,...。

文章
Filter
Apply Filters
Mastodon