[WordPress] 外掛分享: Aside Widget

首頁外掛目錄 › Aside Widget
10+
安裝啟用
尚無評分
5276 天前
最後更新
問題解決
WordPress 2.8+ v0.9 上架:2010-12-19

內容簡介

Aside Widget 外掛允許頁面或文章將任意內容插入側邊欄(或其他動態小工具區域),支援類似於排版中「拉引用」的概念。

當需要在其中一個或多個自定欄位中指定內容的頁面存在時,Aside Widget 會被觸發。將小工具內容控制的中心轉移到頁面,可以更自然地撰寫需要與僅幾頁相關聯的有條件內容。

除了文本,「aside」自定欄位還可以包含 HTML 和/或 PHP 代碼。當然,任何 HTML 都應該精心製作,以免破壞包含的頁面結構。PHP 解析必須在小工具管理面板中明確啟用,並且 ```aside``` 欄位值中的任何 PHP 必須用通常的標籤圍起來才能被識別。

一點短格式魔術可以通過以下方式格式化除隔欄值來觸發。

{# |! | !!} id [,前綴,後綴]

格式為 #id(例如“#232”)的值導致使用整数 id 識別的頁面或文章作為小工具內容。

格式為 !id(例如“!myasidediv”)的值導致使用該 id 識別的 HTML DIV 的內容作為小工具內容。選定的 DIV 必須在當前頁面或文章中存在。通常,選定的 DIV 將從正常頁面內容中移除,但形式為 !!id 的值導致該 DIV 保留在正常頁面內容中。所識別的 DIV 的頁面內容處理並不復雜:DIV 本身不得包含任何其他 DIV,且 DIV ID 屬性必須是標記名之後的第一個屬性。

前綴和後綴可用於指定將用於定位所選小工具內容的任意文本/HTML。也可以使用 PHP,但只有在如上所述啟用解析的情況下才能正常運作。

範例

以下是在「aside」欄位中使用魔術值的幾個範例。

#232

顯示頁面 232 在 Aside Widget 中。

!mydiv

從當前頁面中刪除 <div id='mydiv'>... </div> 的內容,在 Aside Widget 中顯示它。

!!mydiv

與上面相同,但在頁面中保留內容。

!!mydiv,<span style=”bigquote”>,</span>

如上所述,但以某種特殊方式設置 widget 輸出的樣式。

外掛標籤

開發者團隊

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

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

原文外掛簡介

Aside widget allows a page or post to insert arbitrary content into a
sidebar (or other dynamic widget area), supporting something similar to the
typographic notion of a ‘pull-quote’.
Aside widget is triggered by the presence, in those pages which require it,
of one or more ‘aside’ custom fields with values that specify the content
of one or more widgets. Shifting the locus of widget content control from
the widget to the page makes for more natural authoring of conditional
content which needs to be associated with just a small number of pages.
As well as text, an ‘aside’ custom field may contain HTML and/or PHP code.
Of course, any HTML should be crafted so as not to break the containing
page structure. PHP parsing must be explicitly enabled in the widget
administration panel and any PHP in the ‘aside’ field value must be enclosed
in the usual tags for it to be recognised.
A little bit of short-form magic can be triggered by formatting the aside
field value in the following way.
{#|!|!!}id[,prefix,suffix]

A value of the form #id (e.g. ‘#232’) causes the the page or post
identified by the integer id to be used as the widget content.
A value of the form !id (e.g. ‘!myasidediv’) causes the contents of the
HTML DIV identified by id to be used as the widget content. The selected
DIV must reside withing the current page or post. Normally, the selected
DIV is removed from display within the page proper, but a value of the form
!!id causes the DIV to remain in the normal page flow. Processing of page
content for the identified DIV is unsophisticated: the DIV must not itself
contain any other DIVs and the DIV id attribute must be the first attribute
after the tag name.
Prefix and suffix can be used to specify arbitrary text/HTML which will
be used to bracket the selected widget content. PHP can also be used, but
will only work if parsing is enabled as described above.
Examples
A few examples of the use of magic values in the ‘aside’ field.
#232

Display page 232 in the aside widget.
!mydiv

Remove the contents of

...

from the current
page and display it in the aside widget.
!!mydiv

As above, but leave the content in the page.
!!mydiv,,

As above, but style the widget output in some special way.

延伸相關外掛

文章
Filter
Mastodon