ID . '_' . date( 'Y-m-d-H-i-s', strtotime( $post->post_modified_gmt ) ) . '_' . md5( json_encode( $args ) ); if ( $cache = fictioneer_get_cached_story_card( $cache_key ) ) { echo $cache; return; } } // Setup $post_id = $post->ID; $story = fictioneer_get_story_data( $post_id ); $story_link = ( $story['redirect'] ?? 0 ) ?: get_permalink( $post_id ); $latest = $args['show_latest'] ?? FICTIONEER_SHOW_LATEST_CHAPTERS_ON_STORY_CARDS; $chapter_limit = max( 0, FICTIONEER_STORY_CARD_CHAPTER_LIMIT ); $chapter_ids = array_slice( $story['chapter_ids'], $latest ? -1 * $chapter_limit : 0, $chapter_limit, true ); // Does not include hidden or non-chapters $chapter_count = count( $chapter_ids ); $excerpt = fictioneer_first_paragraph_as_excerpt( fictioneer_get_content_field( 'fictioneer_story_short_description', $post_id ) ); $excerpt = empty( $excerpt ) ? fictioneer_get_excerpt( $post_id ) : $excerpt; $tags = false; $card_classes = []; if ( get_option( 'fictioneer_show_tags_on_story_cards' ) && ! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) ) { $tags = get_the_tags(); } // Flags $hide_author = $args['hide_author'] ?? false && ! get_option( 'fictioneer_show_authors' ); $show_terms = ! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) && ( $story['has_taxonomies'] || $tags ); $is_sticky = FICTIONEER_ENABLE_STICKY_CARDS && get_post_meta( $post_id, 'fictioneer_story_sticky', true ) && ! is_search() && ! is_archive(); // Extra classes if ( $is_sticky ) { $card_classes[] = '_sticky'; } if ( get_theme_mod( 'card_style', 'default' ) !== 'default' ) { $card_classes[] = '_' . get_theme_mod( 'card_style' ); } if ( get_theme_mod( 'card_image_style', 'default' ) !== 'default' ) { $card_classes[] = '_' . get_theme_mod( 'card_image_style' ); } if ( ! $show_terms ) { $card_classes[] = '_no-tax'; } // Card attributes $attributes = apply_filters( 'fictioneer_filter_card_attributes', [], $post, 'card-story' ); $card_attributes = ''; foreach ( $attributes as $key => $value ) { $card_attributes .= esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; } // Thumbnail attributes $thumbnail_args = array( 'alt' => sprintf( __( '%s Cover', 'fictioneer' ), $story['title'] ), 'class' => 'no-auto-lightbox' ); // Buffer HTML for cache if active if ( $card_cache_active ) { ob_start(); } ?>
  • >
    %4$s', get_the_post_thumbnail_url( null, 'full' ), sprintf( __( '%s Thumbnail', 'fictioneer' ), $story['title'] ), fictioneer_get_lightbox_attribute(), get_the_post_thumbnail( null, 'cover', $thumbnail_args ) ); } // Content printf( '
    %2$s%3$s
    ', $chapter_count > 2 ? '_3-4' : '_4-4', $hide_author ? '' : sprintf( '%s ', sprintf( _x( 'by %s —', 'Large card: by {Author} —.', 'fictioneer' ), fictioneer_get_author_node() ) ), $excerpt ?: __( 'No description provided yet.', 'fictioneer' ) ); ?> 0 && ! get_option( 'fictioneer_hide_large_card_chapter_list' ) ) : ?>