
內容簡介
這是一個簡單的方式,讓你可以在另一篇文章中加入相關的文章。
你可以藉由使用這個過濾器:SFT_related_item_content filter,輕鬆地更改公開的檢視。
<?php
add_filter (
'SFT_related_item_content' ,
/**
* $itm_container : 相關文章的當前檢視。
* $connected_relations : 帶有所有相關文章項目 ID 的陣列。
* $atts : 短代碼屬性。
*/
function ( $itm_container , $connected_relations , $atts )
{
// 目前文章的 ID。
$post_id = $atts[ 'post_id' ];
// 父相關項目容器元素(在短代碼上設定)。
$container = $atts[ 'container' ];
// 父相關項目容器類別元素(在短代碼上設定)。
$container_class = $atts[ 'container_class' ];
// 相關項目容器元素(在短代碼上設定)。
$item_container = $atts[ 'item_container' ];
// 相關項目容器標題元素(在短代碼上設定)。
$item_title_container = $atts[ 'item_title_container' ];
// 相關項目容器類別元素(在短代碼上設定)。
$item_container_class = $atts[ 'item_container_class' ];
// 顯示相關項目標題(在短代碼上設定為字串 "true" or "false")。
$item_show_title = $atts[ 'item_show_title' ];
// 顯示相關項目日期(在短代碼上設定為字串 "true" or "false")。
$item_show_date = $atts[ 'item_show_date' ];
// 顯示相關項目作者(在短代碼上設定為字串 "true" or "false")。
$item_show_author = $atts[ 'item_show_author' ];
// 顯示相關項目特色圖片(在短代碼上設定為字串 "true" or "false")。
$item_show_feature_image = $atts[ 'item_show_feature_image' ];
// 顯示相關項目摘要圖片(在短代碼上設定為字串 "true" or "false")。
$item_show_excerpt = $atts[ 'item_show_excerpt' ];
// 顯示相關項目內容圖片(在短代碼上設定為字串 "true" or "false")。
$item_show_content = $atts[ 'item_show_content' ];
// 文章相關分類標籤容器元素(在短代碼上設定)。
$item_terms_container = $atts['item_terms_container'];
// 文章相關分類標籤容器類別元素(在短代碼上設定)。
$item_terms_container_class = $atts['item_terms_container_class'];
// 文章相關分類標籤項目容器元素(在短代碼上設定)。
$item_term_container = $atts['item_term_container'];
// 文章相關分類標籤項目容器類別元素(在短代碼上設定)。
$item_term_container_class = $atts['item_term_container_class'];
// 你可以在這裡覆寫文章相關項目檢視...
return $itm_container;
} ,
10 ,
3
);
建議
如果有人有新的外掛功能或想法,歡迎告訴我,可能會在新版本中實現。
外掛標籤
開發者團隊
原文外掛簡介
A simple way to add related posts to another post.
You can easily change the public view by using this filter : SFT_related_item_content filter.
