[WordPress] 外掛分享: single shortcode

首頁外掛目錄 › single shortcode
10+
安裝啟用
尚無評分
5302 天前
最後更新
問題解決
WordPress 2.5+ v0.1.1 上架:2011-08-28

內容簡介

透過這個 single shortcode 外掛,您可以從文章的摘要中隱藏指定的內容。被 [single] 標籤包圍的內容只會在顯示單一頁面時輸出。這對於隱藏以下內容很有用:

目錄
腳註
相對連結等

安裝此外掛後,您可以使用以下簡碼:

[single] 簡碼只會在顯示單一頁面時輸出內容
[excerpt] 簡碼只會在顯示文章摘要時輸出內容

使用方式

使用 [single] 標籤包圍內容。

[single] ... [/single]

[single]
...
[/single]

您可以根據需要使用 [excerpt] 標籤。

[excerpt] ... [/excerpt]

[excerpt]
...
[/excerpt]

範例

如果您輸入以下程式碼:

<p>段落1</p>

[single]
<h5>目錄</h5>
<ul>
<li><a href="#item1">項目1</a></li>
<li><a href="#item2">項目2</a></li>
<li><a href="#item3">項目3</a></li>
</ul>
[/single]

<p>段落2</p>

文章摘要會顯示如下(目錄不會輸出):

段落1

段落2

而單一頁面則會顯示如下(目錄會輸出):

段落1

目錄

項目1
項目2
項目3

段落2

連結

single shortcode 外掛官方網站 (attosoft.info) [日文版]
參考:功能參考 / is_single()(WordPress Codex)

外掛標籤

開發者團隊

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

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

原文外掛簡介

Using single shortcode plugin, you can hide specified content from excerpt of post. The content enclosed with [single] tag is output only if single page is displayed. It’s useful for hiding the following items from excerpt.

table of contents
footnotes
relative links, etc.

Installed this plugin, you can use the following shortcodes.

[single] shortcode outputs content only if single page is displayed
[excerpt] shortcode outputs content only if excerpt is displayed

Usage
Enclose content with [single] tag.
[single] ... [/single]

[single]
...
[/single]

You can use [excerpt] tag as necessary.
[excerpt] ... [/excerpt]

[excerpt]
...
[/excerpt]

Example
If you write the following code,

paragraph1

[single]

Index

[/single]

paragraph2

the excerpt is displayed as follows. (Index is NOT output)

paragraph1
paragraph2

And single page is displayed as follows. (Index is output)

paragraph1
Index

item1
item2
item3

paragraph2

Links

Homepage (attosoft.info) [Japanese]
single shortcode Plugin Official Site [Japanese]
ref. Function Reference / is_single() (WordPress Codex)

延伸相關外掛

文章
Filter
Apply Filters
Mastodon