From aec80b757be4350b5c3d4bfb2663d7c246207dd7 Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Tue, 26 Nov 2024 02:29:26 +0100 Subject: [PATCH] Add more conditions to search-and-filter options --- includes/functions/hooks/_general_hooks.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/includes/functions/hooks/_general_hooks.php b/includes/functions/hooks/_general_hooks.php index 0531aff9..575ddcde 100644 --- a/includes/functions/hooks/_general_hooks.php +++ b/includes/functions/hooks/_general_hooks.php @@ -558,6 +558,7 @@ add_action( 'fictioneer_inner_header', 'fictioneer_inner_header_background', 10 function fictioneer_sort_order_filter_interface( $args ) { // Setup + $template = get_page_template_slug(); $current_url = fictioneer_get_clean_url(); $post_type = null; @@ -653,14 +654,17 @@ function fictioneer_sort_order_filter_interface( $args ) { 'title' => array( 'label' => _x( 'Title', 'Sort and filter option.', 'fictioneer' ), 'url' => add_query_arg( array( 'orderby' => 'title' ), $current_url ) . '#sof' - ), - 'comment_count' => array( - 'label' => _x( 'Comments', 'Sort and filter option.', 'fictioneer' ), - 'url' => add_query_arg( array( 'orderby' => 'comment_count' ), $current_url ) . '#sof' ) ); - if ( ! is_archive() ) { + if ( ! in_array( $template, ['recommendations.php', 'collections.php'] ) ) { + $orderby_menu['comment_count'] = array( + 'label' => _x( 'Comments', 'Sort and filter option.', 'fictioneer' ), + 'url' => add_query_arg( array( 'orderby' => 'comment_count' ), $current_url ) . '#sof' + ); + } + + if ( ! is_archive() && ! in_array( $template, ['recommendations.php', 'collections.php'] ) ) { $orderby_menu['words'] = array( 'label' => _x( 'Words', 'Sort and filter option.', 'fictioneer' ), 'url' => add_query_arg( array( 'orderby' => 'words' ), $current_url ) . '#sof'