have_posts() ) : ?> {$page[1]}"; $index++; if ( $index > FICTIONEER_MAX_CUSTOM_PAGES_PER_STORY ) { break; // Only show 4 custom tabs } } } ?>
FICTIONEER_MAX_CUSTOM_PAGES_PER_STORY ) { break; // Only show 4 custom tabs } } } ?>
'fcn_chapter', 'post_status' => 'publish', 'post__in' => fictioneer_rescue_array_zero( $chapters ), 'ignore_sticky_posts' => true, 'orderby' => 'post__in', // Preserve order from meta box 'posts_per_page' => -1, // Get all chapters (this can be hundreds) 'no_found_rows' => true, // Improve performance 'update_post_term_cache' => false // Improve performance ) ); // Prepare chapter groups if ( $chapter_query->have_posts() ) { while( $chapter_query->have_posts() ) { // Setup $chapter_query->the_post(); $chapter_id = get_the_ID(); // Skip not visible chapters (redundant for paranoia) if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) ) { continue; } // Data $group = fictioneer_get_field( 'fictioneer_chapter_group' ); $group = empty( $group ) ? fcntr( 'unassigned_group' ) : $group; $group = $enable_groups ? $group : 'all_chapters'; $group_key = sanitize_title( $group ); if ( ! array_key_exists( $group_key, $chapter_groups ) ) { $chapter_groups[sanitize_title( $group )] = array( 'group' => $group, 'data' => [] ); } $chapter_groups[sanitize_title( $group )]['data'][] = array( 'id' => get_the_ID(), 'link' => get_permalink(), 'timestamp' => get_the_time( 'c' ), 'password' => ! empty( $post->post_password ), 'list_date' => get_the_date( '', $post ), 'grid_date' => get_the_time( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" ), 'icon' => fictioneer_get_icon_field( 'fictioneer_chapter_icon' ), 'text_icon' => fictioneer_get_field( 'fictioneer_chapter_text_icon' ), 'prefix' => fictioneer_get_field( 'fictioneer_chapter_prefix' ), 'title' => fictioneer_get_safe_title( $chapter_id ), 'list_title' => fictioneer_get_field( 'fictioneer_chapter_list_title' ), 'words' => get_post_meta( $chapter_id, '_word_count', true ), 'warning' => fictioneer_get_field( 'fictioneer_chapter_warning' ) ); } } // Reset postdata wp_reset_postdata(); } // Build HTML if ( ! empty( $chapter_groups ) ) { $group_index = 0; $has_groups = count( $chapter_groups ) > 1 && get_option( 'fictioneer_enable_chapter_groups' ); foreach ( $chapter_groups as $group ) { $index = 0; $group_chapter_count = count( $group['data'] ); $reverse_order = 99999; $chapter_folding = ! $disable_folding && ! get_option( 'fictioneer_disable_chapter_collapsing' ); $chapter_folding = $chapter_folding && count( $group['data'] ) >= FICTIONEER_CHAPTER_FOLDING_THRESHOLD * 2 + 3; $aria_label = __( 'Toggle chapter group: %s', 'fictioneer' ); $group_index++; // Start HTML ---> ?>
    FICTIONEER_CHAPTER_FOLDING_THRESHOLD && $index < ( $group_chapter_count + 2 - FICTIONEER_CHAPTER_FOLDING_THRESHOLD ); ?>
  1. true ) ); ?>
?>
    have_posts() ) { while ( $blog_posts->have_posts() ) { $blog_posts->the_post(); // Start HTML ---> ?>
  1. :