[WordPress] 外掛分享: Softmixt Relations

首頁外掛目錄 › Softmixt Relations
WordPress 外掛 Softmixt Relations 的封面圖片
全新外掛
安裝啟用
尚無評分
2871 天前
最後更新
問題解決
WordPress 4.6+ v2.0.0 上架:2017-07-01

內容簡介

這是一個簡單的方式,讓你可以在另一篇文章中加入相關的文章。

你可以藉由使用這個過濾器: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
);

建議

如果有人有新的外掛功能或想法,歡迎告訴我,可能會在新版本中實現。

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Softmixt Relations」→ 直接安裝(推薦)

原文外掛簡介

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.

延伸相關外掛

文章
Filter
Mastodon