內容簡介
隨著區塊的日漸普及,開發人員和商店所有者發現一些模板功能缺失,通常透過 PHP 和 WordPress Hooks 可以獲得。 WordPress 社區正在努力將 PHP 中的可擴展性工具和框架轉移到 JavaScript,但有些工具還不夠完整!此外掛程式創建了一些新的短代碼,以暫時填補這個空白,還可以幫助用戶 / 管理員在不進入主題或插件的情況下進行範本設置。
第一個短代碼與 WordPress Actions 相關,適當地遵循參數命名慣例。
[action_runner_trs name="woocommerce_before_cart"]
第二個短代碼與 WordPress Filters 相關。
[filter_runner_trs name="woocommerce_shipping_estimate_html" content="Shipping options will be updated during checkout."]
這些短代碼有一些嚴重限制,可以提供給用戶使用。 函數 do_action()和 apply_filters()可以附加複雜的代碼,並可能依賴於在 Hooks 存在頁面上通常可訪問的全局變量。
代碼是以一種方式編寫的,即使在區塊編輯器中,短代碼也不會嘗試在網站管理部分執行。這尤其值得注意,因為區塊編輯器嘗試將短代碼的代碼作為預覽呈現,並將其寫入數據庫作為文章內容。
我們建議用戶將此插件放置在測試伺服器上,並測試您想在相關頁面上使用的特定 Hooks,以免破壞任何用戶體驗。
最初設計用於與 WooCommerce Blocks Cart 和 Checkout 頁面配合使用,我們需要讓用戶能夠發送通知,提醒用戶可以將其積分和獎勵應用到他們的購物車。此外,它還適用於與各種插件配合使用,例如 hook into upsell actions 或 couponing。
這個外掛和使用短代碼的方式非常適合用於快速測試或在您的網站上發布快速消息的定制解決方案。
外掛標籤
開發者團隊
② 後台搜尋「Action Runner by The Rite Sites」→ 直接安裝(推薦)
📦 歷史版本下載
原文外掛簡介
With the increasing popularity of blocks, developers and store owners alike have been finding some templating features missing normally available through the use of PHP and WordPress Hooks.
The WordPress community is hard at work to create the extensibility tools and framework that exists in PHP into javascript, but some of the tools are not quite there!
This plugin creates a couple new shortcodes to help bridge the gap temporarily, as well as help users/admins with “templating” without going into your theme or plugins.
The first shortcode is in relation to WordPress Actions and aptly follows the parameter naming convention.
[action_runner_trs name="woocommerce_before_cart"]
The second shortcode, in relation to WordPress Filters
[filter_runner_trs name="woocommerce_shipping_estimate_html" content="Shipping options will be updated during checkout."]
There are serious limitations these shortcodes have to offer users. The functions do_action() and apply_filters() can have complex code attached to them, and may rely on global variables that are typically accessible on pages the Hooks have existed on.
The code is written in a way that even in the block editor, the shortcodes will not attempt to execute in the administrative side of your website. This is especially notable as the Block Editor attempts to render the code of a shortcode as a preview and writing in the database as post_content.
We recommend users to put this plugin on a staging server and do a test of the specific Hooks you would like to use on the applicable page(s) as to not break any user experiences.
Originally designed to work with the WooCommerce Blocks Cart and Checkout pages, we needed to enable users to have the message that notified users can apply their Points and Rewards,
it also works with plugins that hook into upsell actions or couponing like Pretty Coupons, Smart Coupon, or even your own custom action, which can be created on the fly!
This plugin pairs nicely with getting custom solutions to your front end quickly for testing or quick notices on your website, especially when using a snippets plugin.
