diff --git a/INSTALLATION.md b/INSTALLATION.md index 2e04d770..1a40f8d7 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -1518,4 +1518,5 @@ define( 'CONSTANT_NAME', value ); | FICTIONEER_ENABLE_STORY_CHANGELOG | boolean | Whether changes to the story chapter list should be logged. Default `true`. | FICTIONEER_DEFER_SCRIPTS | boolean | Whether to defer scripts or load them in the footer. Default `true`. | FICTIONEER_ENABLE_ASYNC_ONLOAD_PATTERN | boolean | Whether the [onload pattern](https://www.filamentgroup.com/lab/load-css-simpler/) for asynchronous CSS loading is used. Default `true`. +| FICTIONEER_SHOW_LATEST_CHAPTERS_ON_STORY_CARDS | boolean | Whether to show the latest instead of the first chapters on story cards. | FICTIONEER_EXAMPLE_CHAPTER_ICONS | array | Collection of example Font Awesome icon class strings. diff --git a/functions.php b/functions.php index c249e2cd..bde088bd 100644 --- a/functions.php +++ b/functions.php @@ -408,6 +408,11 @@ if ( ! defined( 'FICTIONEER_ENABLE_ASYNC_ONLOAD_PATTERN' ) ) { define( 'FICTIONEER_ENABLE_ASYNC_ONLOAD_PATTERN', true ); } +// Boolean: Whether to show the latest instead of the first chapters on story cards +if ( ! defined( 'FICTIONEER_SHOW_LATEST_CHAPTERS_ON_STORY_CARDS' ) ) { + define( 'FICTIONEER_SHOW_LATEST_CHAPTERS_ON_STORY_CARDS', false ); +} + // ============================================================================= // GLOBAL // ============================================================================= diff --git a/partials/_card-story.php b/partials/_card-story.php index 1d43f10e..9d4c2792 100644 --- a/partials/_card-story.php +++ b/partials/_card-story.php @@ -22,7 +22,7 @@ defined( 'ABSPATH' ) OR exit; $post_id = $post->ID; $story = fictioneer_get_story_data( $post_id ); $story_link = ( $story['redirect'] ?? 0 ) ?: get_permalink( $post_id ); -$latest = $args['show_latest'] ?? false; +$latest = $args['show_latest'] ?? FICTIONEER_SHOW_LATEST_CHAPTERS_ON_STORY_CARDS; $chapter_ids = array_slice( $story['chapter_ids'], $latest ? -3 : 0, 3, true ); // Does not include hidden or non-chapters $chapter_count = count( $chapter_ids ); $excerpt = fictioneer_first_paragraph_as_excerpt(