[WordPress] 外掛分享: Template Part Shortcode

首頁外掛目錄 › Template Part Shortcode
100+
安裝啟用
★★★★★
5/5 分(1 則評價)
4923 天前
最後更新
問題解決
WordPress 3.4+ v0.1 上架:2012-11-08

內容簡介

範本部件是儲存在您主題目錄中的可重複使用的程式碼片段。通常,它們被其他範本檔案使用 get_template_part() 函式來呼叫。此外掛會建立一個捷徑,以便您可以在文章內容中呼叫範本部件。

捷徑的使用方式為:[template part=”somepart”]。

範本部件必須存放在主題目錄中的「parts」資料夾內。

如果您在範本部件中使用自訂迴圈,請記得在結尾處使用「reset_query」函式以將頁面恢復正常。

外掛標籤

開發者團隊

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

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

原文外掛簡介

Template parts are reusable snippets of code stored in your theme directory. Normally, they are called by other template files using the get_template_part() function. This plugin creates a shortcode for calling template parts from the body of a post.
Shortcode usage is: [template part=”somepart”].
Template parts must be stored in a “parts” folder within your theme directory.
If you use custom loops in your template parts, remember to use “reset_query” at the end to return the page to normal.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon