Add FICTIONEER_SHOW_LATEST_CHAPTERS_ON_STORY_CARDS
This commit is contained in:
parent
47ef9ef1ea
commit
15b06704c8
@ -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.
|
||||
|
@ -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
|
||||
// =============================================================================
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user