[WordPress] 外掛分享: Post Content Shortcode

首頁外掛目錄 › Post Content Shortcode
WordPress 外掛 Post Content Shortcode 的封面圖片
40+
安裝啟用
尚無評分
287 天前
最後更新
問題解決
WordPress 5.0+ PHP 7.0+ v1.0.1 上架:2025-06-28

內容簡介

總結:
Post Content Shortcode 外掛允許您使用 shortcode 顯示任何文章的內容。這對於在多個位置重複使用內容、內嵌其他文章或包含動態更新的內容塊非常有用。您可以從外掛的設置頁面在「設置 → Post Content Shortcode」下配置允許使用的文章狀態。

問題與答案:
1. Post Content Shortcode 外掛的主要功能是什麼?
- 回答:允許使用 shortcode 顯示任何文章的內容。

2. 如何使用 shortcode 嵌入特定文章的內容?
- 回答:在文章中使用以下格式的 shortcode:[post_content id="文章ID"]。將「文章ID」替換為您想要嵌入的文章的ID。

3. 如何避免文章內容之間的無限迴圈?
- 回答:外掛會防止一篇文章包含自身,從而避免無限迴圈。

4. 如何自訂 shortcode 標籤?
- 回答:您可以在主題的 functions.php 檔案中添加代碼來更改 shortcode 標籤,例如 add_filter('herron_pcs_shortcode_tag', function( $tag ) { return 'my_custom_shortcode'; });。更改後,使用新標籤 [my_custom_shortcode id="文章ID"]。設置頁面和邏輯將自動尊重這個更改。

外掛標籤

開發者團隊

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

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

原文外掛簡介

Post Content Shortcode allows you to display the content of any post using a shortcode like:
[post_content id=”123″]
This is useful for reusing content in multiple places, referencing another post inline, or including dynamically updated blocks of content.
You can configure which post statuses are allowed to be embedded from the plugin’s settings page under Settings → Post Content Shortcode.
Usage
Use the shortcode like this:
[post_content id=”123″]
Where 123 is the ID of the post you want to embed.
To avoid infinite loops, the plugin prevents a post from including itself.
Only posts with selected statuses (e.g. Published, Draft) will be rendered. You can control this from the plugin settings page.
Customizing the Shortcode Tag
By default, the shortcode tag is post_content. You can change it by adding this to your theme’s functions.php file:
add_filter( ‘herron_pcs_shortcode_tag’, function( $tag ) {
return ‘my_custom_shortcode’;
});
After doing so, use the new tag:
[my_custom_shortcode id=”123″]
The settings page and all logic will automatically respect this change.
Learn More About Herron
This plugin is part of Herron’s ongoing effort to give back to the WordPress community. If you’re interested in how we build custom WordPress solutions for clients or want to collaborate, please visit https://herron.agency/.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon