內容簡介
WP Advanced Include建立了一個「[include]」短代碼,可用於添加來自網站上任何文章或頁面的內容,包括文章內容、文章摘要和文章的 Meta 資料。
短代碼屬性:
content_id = [int] - 要包含內容的文章或頁面的 ID。
content_limit = [int] - 如有需要,限制內容,設定小於 1 的值以移除限制 - 預設值為 0。
content_limit_type ["words"|"chars"] - 設定限制內容是字詞或字元 - 預設值為「words」。
content_limit_append [string | 空字串] - 如果限制了內容,該字串將附加在內容末尾 - 預設值為「&hellip」。
content_type [post_content | post_excerpt | post_title | "meta name"] - 要包含的內容類型,如果是 Meta 名稱,請指定 Meta 名稱 - 預設值為「post_content」。
do_shortcode [true|false] - 指定是否解析短代碼 - 預設值為「true」。
注意事項
注意:使用「[include]」短代碼且將「do_shortcode」設定為 true,將會產生無限迴圈,請謹慎使用。
範例
簡單地包含文章內容
[include content_id=x]
包含文章內容的前 50 個字詞
[include content_id=x content_limit=50]
包含文章內容的前 150 個字元
[include content_id=x content_limit=150 content_limit_type=chars]
*包含文章 X 的「custom_meta_name」Meta 資料
[include content_id=x content_type="custom_meta_name"]
外掛標籤
開發者團隊
原文外掛簡介
WP Advanced Include creates an [include] shortcode which can be used to add content from any Post or Page on your site including Post Content, Post Excerpt and Post Meta
Shortcode Attributes:
content_id = [int] The id of the post or page you wish to include content from.
content_limit = [int] Limits the content if required, set to a value less than 1 to remove limiting – Default 0
content_limit_type [“words”|”chars”] Sets the content limit to be words or characters – Default “words”
content_limit_append [string|empty string] Text to be appended to the end of the content if limited – Default “&hellip”
content_type [post_content|post_excerpt|post_title|”meta name”] The content type to be included, if meta name, specify meta name. – Default “post_content”
do_shortcode [true|false] Specify whether to parse shortcodes of not – Default “true”
Caution
The use of [include] to include itself with do_shortcode set to true will create an infinite loop, use wisely.
Samples
simple include of post content
[include content_id=x]
include first 50 words of post content
[include content_id=x content_limit=50]
include first 150 characters of post content
[include content_id=x content_limit=150 content_limit_type=chars]
*include “custom_meta_name” meta from post X
[include content_id=x content_type=”custom_meta_name”]
