
內容簡介
此外掛提供一個簡單的 [meta] 短碼,允許您獲取當前 $post 的 meta 資訊。
可以選擇返回單個值、使用使用者定義的分隔符串聯的多個值,或 JSON 字串。
範例:
[meta name="your_meta_field"]
將返回您指定的「your_meta_field」的值。如果該值是一個陣列,它將返回一個以逗號分隔的列表,除非您指定另一個分隔符。
[meta name="your_meta_field" single="false"]
預設情況下,[meta] 將返回單個值。如果您有多個具有相同名稱的 meta 欄位,則可以將 single 設置為「false」以獲取它們全部。
[meta name="your_meta_field" single="false" json="true"]
這將返回 JSON 編碼的「your_meta_field」值。
[meta name="your_meta_field" single="false" join="|"]
這會返回一個以「|」為分隔符的「your_meta_field」值。
[meta name="your_meta_field" shortcode="false"]
預設情況下,該值將傳遞給 do_shortcode,除非您關閉它。
[meta name="your_meta_field" filters="true"]
如果您想過濾值,則有一些可用的篩選器。它們在 do_shortcode 之後被調用,並且在任何 JSON 或陣列處理之前被調用。
它們預設開啟,但可以使用 filters=”false” 關閉。這些篩選器是「meta_fetcher_value」和「meta_fetcher_{$name}」。
外掛標籤
開發者團隊
原文外掛簡介
This plugin provides a simple [meta] shortcode that allows you to fetch meta information for the current $post.
There are options to return a single value, multiple values joined by a user defined string, or a JSON string.
Examples:
[meta name="your_meta_field"]
This will return the value of “your_meta_field”. If the value is an array, it will return a comma separated list, unless you specify an alternative join string.
[meta name="your_meta_field" single="false"]
By default, [meta] will return a single value. If you have multiple meta fields with the same name, you can get them all by setting single=”false”.
[meta name="your_meta_field" single="false" json="true"]
This will return the JSON encoded value of “your_meta_field”.
[meta name="your_meta_field" single="false" join="|"]
This will return a pipe separated values of “your_meta_field”.
[meta name="your_meta_field" shortcode="false"]
By default, the value will be passed to do_shortcode, unless you turn if off.
[meta name="your_meta_field" filters="true"]
There are a couple filters available if you want to filter the value. They are called after do_shortcode and before any JSON/array handling.
They are on be default, but can be turned of with filters=”false”. The filters are “meta_fetcher_value” and “meta_fetcher_{$name}”.
