[WordPress] 外掛分享: Simple Subtitles

首頁外掛目錄 › Simple Subtitles
30+
安裝啟用
★★★★★
5/5 分(1 則評價)
3591 天前
最後更新
問題解決
WordPress 3.5+ v2.1.1 上架:2016-04-10

內容簡介

Simple Subtitles 在文章、頁面或自訂文章類型上新增一個欄位,供您新增副標題。您可以在撰寫設定中啟用/停用文章類型。

插件中有幾個函數可讓您輕鬆地取得不同內容的副標題。這些函數反映了標題核心中的函數。

如果要在您自己的佈景主題中顯示副標題,請使用以下過濾器:
<?php
function mytheme_disable_subtitle_display( $show ) {
return false;
}
add_filter( 'simple_subtitle_auto', 'mytheme_disable_subtitle_display' );
?>

預設情況下,副標題僅允許使用 <br> 標記(僅限於 class 和 style 屬性)。有一個過濾器可以完成此項作業。
<?php
function mytheme_simple_subtitle_allowed_html( $allowed ) {
$allowed['strong'] = array();
$allowed['div'] = array(
'class' => true,
);

return $allowed;
}
add_filter( 'simple_subtitle_allowed_html', 'mytheme_simple_subtitle_allowed_html' );

?>

詳細資訊,請閱讀關於wp_kses 函式。

取得副標題
<?php $subtitle = get_the_simple_subtitle( $post_id ); ?>

顯示當前文章的副標題。應在循環內使用。
<?php $subtitle = the_simple_subtitle( $before = '', $after = '', $echo = true ); ?>

為在 HTML 屬性中使用而取得副標題
<?php
$args = array(
'before' => '',
'after' => '',
'echo' => true
);
$subtitle = the_simple_subtitle_attribute( $args );
?><h3>路線圖</h3>

* 在管理區新增一欄以顯示副標題。
* 新增一個設定項目,以選擇副標題 HTML 標記。

外掛標籤

開發者團隊

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

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

原文外掛簡介

Simple subtitles adds a field on posts, pages, or custom post types for adding a subtitle. Post types can be enabled/disabled in the writing settings section.
There are several functions in the plugin that allow you to easily get subtitles for different contexts. These functions mirror the functions in core for titles.
If you want to display the subtitle in your theme on your own, use the following filter:

By default, only tags are allowed in subtitles (with only class and style attributes). There is a filter this.
true,
);

return $allowed;
}
add_filter( 'simple_subtitle_allowed_html', 'mytheme_simple_subtitle_allowed_html' );

?>

For more info on this, read into the wp_kses functions.
Get the subtitle.

Display the current post’s subtitle. Should be used within the loop.

Get the subtitle for use in an HTML attribute.
'',
'after' => '',
'echo' => true
);
$subtitle = the_simple_subtitle_attribute( $args );
?>

Roadmap

* Add a column in the admin showing subtitles.
* Add a setting for selecting the subtitle HTML tag.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon