Fix Latest Update chapter list maximum

This commit is contained in:
Tetrakern 2024-07-27 01:33:40 +02:00
parent dd626b117b
commit d0962f8df6

View File

@ -185,13 +185,15 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
}
$chapter_list[] = $chapter_post;
$max = ( $args['single'] || $args['type'] === 'single' ) ? 0 : 1;
if ( count( $chapter_list ) > $max ) {
if ( count( $chapter_list ) > 1 ) {
break; // Max one or two
}
}
// Slice chapter list down
$chapter_list = array_slice( $chapter_list, 0, ( $args['single'] || $args['type'] === 'single' ) ? 1 : 2 );
// No viable chapters
if ( count( $chapter_list ) < 1 ) {
continue;