內容簡介
這個外掛支援 3 個分類塊。
分類塊 - 顯示指定分類法中的所有分類。可用於像是詞彙表般的分類清單。
文章分類塊 - 顯示指定分類法中指派給文章的分類。
文章相同分類查詢塊 - 顯示相關文章列表,並且擁有和當前文章相同的分類。
客製化
樣板結構
若要覆蓋外觀,請將樣板放置於您的佈景主題目錄中。
template-parts
- taxonomy-blocks
- posts-list.php // 文章相同分類查詢塊中的文章列表。
- post-loop.php // 文章相同分類查詢塊中的文章連結。
- term-item.php // 分類連結。
- term-list.php // 平面分類清單。
- term-list-hierarchical.php // 階層式分類清單。
也可使用 taro_taxonomy_blocks_template 過濾器來覆蓋樣板路徑。
樣式
若要覆蓋樣式,請註冊名稱為 taro-terms-block 的樣式。
該外掛在 init 勾子的優先順序 20 註冊樣式,所以您應該在優先順序 10 註冊。
add_action( 'init', function() {
// 您自己的 CSS。
wp_register_style( 'taro-terms-block', $your_block_css_url, $deps, $version );
} );
現在您的分類塊將使用您自己的 CSS 設計風格。
外掛標籤
開發者團隊
原文外掛簡介
This plugin supports 3 term blocks.
Terms Block – Display all terms in the specified taxonomy. Usefull to display terms list like glossary.
Post’s Terms Block – Display terms assigned to the post in the specified taxonomy.
Post’s Terms Query Block – Display post list with same terms with the post.
Customization
All blocks are customizable on the PHP layer.
Template Structure
To override look and feel, put template files in your theme’s directory.
your-theme-dir
- template-parts
- taxonomy-blocks
- posts-list.php // List of post in post's terms query blocks.
- post-loop.php // Post link in post's terms query blocks.
- term-item.php // Term link.
- term-list.php // Flat term list.
- term-list-hierarchical.php // Hierarchical terms list.
taro_taxonomy_blocks_template filter hook is also available.
This will override the template file path.
Styles
To override styles, regsiter styels named taro-terms-block.
The plugin registers style at priority 20 of init hook, so registering style at priority 10 or earlier.
add_action( 'init', function() {
// Your own CSS.
wp_register_style( 'taro-terms-block', $your_block_css_url, $deps, $version );
} );
Now your blocks will be styled by your CSS.
