[WordPress] 外掛分享: Shortcodes

首頁外掛目錄 › Shortcodes
10+
安裝啟用
尚無評分
3087 天前
最後更新
問題解決
WordPress 3+ v1.0.4 上架:2017-09-25

內容簡介

這個 WordPress 外掛提供了簡潔的代碼,使用短代碼取得 WordPress 核心資料,如取得選項、取得文章中的自訂欄位、取得自訂文章型別中的自訂欄位等等。
以下是短代碼的使用方式:

[wp_get_option]
例如:[wp_get_option option=’blogname’]

[wp_get_post_meta]
例如:[wp_get_post_meta key=’your-meta-field’ single=true]

[wp_get_metadata]
例如:[wp_get_metadata meta_type=’comment’ meta_key=’your-meta-field’ single=true]

[wp_get_the_thumbnail]
例如:[wp_get_the_thumbnail]

短代碼作為另一個短代碼的參數使用。
例如:[wp_get_the_post_thumbnail post={{wp_get_the_ID}} size=”medium”]
「wp_get_the_ID」是一個取得當前文章 ID 的短代碼,並且把取得的文章 ID 傳遞到「wp_get_the_post_thumbnail」短代碼的 post 參數內。若要將短代碼作為參數的值傳遞,就需要使用 {{短代碼}} 的語法,而非 [短代碼] 的語法。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.4) 或搜尋安裝

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

原文外掛簡介

Shortcodes providing WordPress core shortcode for get option, get post meta, get custom post meta and other WordPress data using shortcode.
Shortcodes:

[wp_get_option]
Ex. [wp_get_option option=’blogname’]

[wp_get_post_meta]
Ex. [wp_get_post_meta key=’your-meta-field’ single=true]

[wp_get_metadata]
Ex. [wp_get_metadata meta_type=’comment’ meta_key=’your-meta-field’ single=true]

[wp_get_the_thumbnail]
Ex. [wp_get_the_thumbnail]

Use of shortcode as parameter of another shortcode.
Ex. [wp_get_the_post_thumbnail post={{wp_get_the_ID}} size=”medium” ]
“wp_get_the_ID” is a shortcode to get current post id which is is passed to post parameter of “wp_get_the_post_thumbnail” shortcode. To pass shortcode as parameter value you need to use {{shortcode}} syntax instead of [shortcode].

文章
Filter
Mastodon