ID, 'fcn_fandom' ); $characters = get_the_terms( $post->ID, 'fcn_character' ); $genres = get_the_terms( $post->ID, 'fcn_genre' ); } // Flags $show_type = $args['show_type'] ?? false; $show_taxonomies = ! get_option( 'fictioneer_hide_taxonomies_on_collection_cards' ) && ( $fandoms || $characters || $genres || $tags ); // Query featured posts if ( ! empty( $items ) ) { $items = new WP_Query( array( 'post_type' => 'any', 'post_status' => 'publish', 'post__in' => fictioneer_rescue_array_zero( $items ), 'ignore_sticky_posts' => true, 'orderby' => 'modified', 'posts_per_page' => -1, 'update_post_meta_cache' => false, // Improve performance 'update_post_term_cache' => false, // Improve performance 'no_found_rows' => true // Improve performance ) ); $items = $items->posts; } // Statistics if ( ! empty( $items ) ) { foreach ( $items as $item ) { // Count by type switch ( $item->post_type ) { case 'fcn_chapter': if ( ! in_array( $item->ID, $processed_ids ) ) { $chapter_count += 1; $word_count += get_post_meta( $item->ID, '_word_count', true ); $processed_ids[] = $item->ID; } break; case 'fcn_story': $story_count += 1; $chapter_ids = fictioneer_get_field( 'fictioneer_story_chapters', $item->ID ); // Try to rescue an empty description by using one from a story... if ( empty( $description ) ) { $description = fictioneer_first_paragraph_as_excerpt( fictioneer_get_content_field( 'fictioneer_story_short_description', $item->ID ) ); } // Query eligible chapters $chapter_query_args = array( 'post_type' => 'fcn_chapter', 'post_status' => 'publish', 'post__in' => fictioneer_rescue_array_zero( $chapter_ids ), 'posts_per_page' => -1, 'update_post_term_cache' => false, // Improve performance 'no_found_rows' => true // Improve performance ); $chapters = new WP_Query( $chapter_query_args ); $chapters = $chapters->posts; if ( ! empty( $chapters ) ) { foreach ( $chapters as $chapter ) { if ( fictioneer_get_field( 'fictioneer_chapter_no_chapter', $chapter->ID ) || fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter->ID ) ) { continue; } if ( ! in_array( $chapter->ID, $processed_ids ) ) { $chapter_count += 1; $word_count += get_post_meta( $chapter->ID, '_word_count', true ); $processed_ids[] = $chapter->ID; } } } break; } } // Prepare features items $items = array_slice( $items, 0, 3 ); } // Required since it's possible to add chapters to collection outside of // their stories, which would cause the comments to be counted twice. $comment_args = array( 'post_type' => 'fcn_chapter', 'status' => 1, 'post__in' => fictioneer_rescue_array_zero( $processed_ids ), 'count' => true, 'update_comment_meta_cache' => false // Improve performance ); $comment_count = get_comments( $comment_args ); ?>
  • %4$s', get_the_post_thumbnail_url( null, 'full' ), sprintf( __( '%s Thumbnail', 'fictioneer' ), $title ), fictioneer_get_lightbox_attribute(), get_the_post_thumbnail( null, 'cover' ) ); } // Content printf( '
    %2$s
    ', count( $items ) > 2 ? '_3-4' : '_4-4', $description ); ?>