From 93ac11118b44438abe1ea519b5803b5d471899e5 Mon Sep 17 00:00:00 2001 From: bigfa Date: Fri, 13 Sep 2024 10:48:04 +0800 Subject: [PATCH] fix:fixed related post error with default post format --- README.md | 6 +++++- README_CN.md | 6 +++++- style.css | 2 +- template-parts/single-related.php | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 33ae409..042313e 100755 --- a/README.md +++ b/README.md @@ -6,12 +6,16 @@ Farallon is a simple single column wordpress theme with perfect performace and e [中文说明](https://github.com/bigfa/Farallon/blob/develop/README_CN.md) -latest version : `0.7.3` +latest version : `0.7.4` [Simple User Guide(Chinese)](https://fatesinger.com/101971) ## Changelog +### 0.7.4 + +- fixed related post error with default post format + ### 0.7.3 - stable release diff --git a/README_CN.md b/README_CN.md index 7fa7ce8..c7700ba 100755 --- a/README_CN.md +++ b/README_CN.md @@ -2,7 +2,7 @@ ![Wordpress 主题 Farallon](https://static.fatesinger.com/2023/06/u1ak8xgmyn9ec24r.png) -最新版本: `0.7.3` +最新版本: `0.7.4` 本主题禁止各种修改作者链接打包重新发布的行为。 @@ -10,6 +10,10 @@ ## 更新日志 +### 0.7.4 + +- 修复默认文章格式下相关文章错误的问题 + ### 0.7.3 - 稳定版发布 diff --git a/style.css b/style.css index 5e0924e..9a085d4 100755 --- a/style.css +++ b/style.css @@ -4,6 +4,6 @@ Theme URI: https://github.com/bigfa/Farallon Author: bigfa Author URI: https://github.com/bigfa Description: theme 2024 -Version: 0.7.3 +Version: 0.7.4 Tags: Minimalism, Responsive */ diff --git a/template-parts/single-related.php b/template-parts/single-related.php index fb9daae..aec4e6a 100755 --- a/template-parts/single-related.php +++ b/template-parts/single-related.php @@ -7,14 +7,14 @@ 'post__not_in' => array(get_the_ID()), 'posts_per_page' => 6, 'category__in' => wp_get_post_categories(get_the_ID()), - 'tax_query' => array( // same post format + 'tax_query' => get_post_format(get_the_ID()) ? array( // same post format array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-' . get_post_format(get_the_ID())), 'operator' => 'IN' ) - ) + ) : array() )); while ($the_query->have_posts()) : $the_query->the_post(); ?>