Update RSS templates

This commit is contained in:
Tetrakern 2023-08-08 22:58:51 +02:00
parent 373baa55c9
commit 89a305fde4
2 changed files with 16 additions and 4 deletions

View File

@ -11,7 +11,7 @@
// Query posts
$posts = new WP_Query(
array (
'post_type' => array( 'post', 'fcn_story', 'fcn_chapter', 'fcn_recommendation' ),
'post_type' => ['post', 'fcn_story', 'fcn_chapter', 'fcn_recommendation'],
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
@ -65,6 +65,7 @@ echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?>';
// Fire default action
do_action( 'rss_tag_pre', 'rss2' );
?>
<rss

View File

@ -131,17 +131,28 @@ do_action( 'rss_tag_pre', 'rss2' );
// Limit items
$terminator = get_option( 'posts_per_rss' );
// Query
$query_args = array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => $chapters,
'orderby' => 'post__in',
'posts_per_page' => get_option( 'posts_per_rss' ) + 4, // Buffer for hidden items
'no_found_rows' => true // Improve performance
);
$chapter_query = new WP_Query( $query_args );
// Loop over chapters
foreach ( $chapters as $post_id ) {
foreach ( $chapter_query->posts as $post ) {
// Setup
$post = get_post( $post_id );
setup_postdata( $post );
// Terminate?
if ( $terminator < 1 ) break;
// Skip invisible chapters
if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) || get_post_status() !== 'publish' ) {
if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) ) {
continue;
}