Let collections ignore hidden stories

This commit is contained in:
Tetrakern 2023-06-16 02:07:03 +02:00
parent 97fb5cae04
commit 07c76a9d35
2 changed files with 18 additions and 2 deletions

View File

@ -47,6 +47,11 @@ if ( ! empty( $args['featured_list'] ) ) {
$processed_ids[] = $post_id;
}
} elseif ( $post_type == 'fcn_story' ) {
// Skip hidden stories
if ( fictioneer_get_field( 'fictioneer_story_hidden', $post_id ) ) {
continue;
}
$story = fictioneer_get_story_data( $post_id );
$story_count += 1;

View File

@ -32,7 +32,7 @@
$featured_list = empty( $featured_list ) ? [] : $featured_list;
$title = fictioneer_get_safe_title( $post->ID );
$this_breadcrumb = [$title, get_the_permalink()];
$current_page = max( 1, get_query_var( 'pg', 1 ) ); // Paged not available
$current_page = max( 1, get_query_var( 'pg', 1 ) ?: 1 ); // Paged not available
// Clean featured list of unwanted entries
foreach ( $featured_list as $key => $post_id ) {
@ -49,7 +49,18 @@
'orderby' => 'modified',
'order' => 'DESC',
'paged' => $current_page,
'posts_per_page' => get_option( 'posts_per_page', 8 )
'posts_per_page' => get_option( 'posts_per_page', 8 ),
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'fictioneer_story_hidden',
'value' => '0'
),
array(
'key' => 'fictioneer_story_hidden',
'compare' => 'NOT EXISTS'
),
)
);
// Query featured posts