Add option to show latest chapters on large story cards

This commit is contained in:
Tetrakern 2024-08-01 23:37:29 +02:00
parent 37cda67d39
commit 9d2933eb2a
4 changed files with 22 additions and 2 deletions

View File

@ -1517,5 +1517,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_SHOW_LATEST_CHAPTERS_ON_STORY_CARDS | boolean | Whether to show the latest instead of the first chapters on story cards. Default `false`.
| FICTIONEER_EXAMPLE_CHAPTER_ICONS | array | Collection of example Font Awesome icon class strings.

View File

@ -405,7 +405,10 @@ if ( ! defined( 'FICTIONEER_ENABLE_ASYNC_ONLOAD_PATTERN' ) ) {
// 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 );
define(
'FICTIONEER_SHOW_LATEST_CHAPTERS_ON_STORY_CARDS',
get_option( 'fictioneer_show_story_cards_latest_chapters' ) ? true : false
);
}
// =============================================================================

View File

@ -594,6 +594,12 @@ define( 'FICTIONEER_OPTIONS', array(
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
'default' => 0
),
'fictioneer_show_story_cards_latest_chapters' => array(
'name' => 'fictioneer_show_story_cards_latest_chapters',
'group' => 'fictioneer-settings-general-group',
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
'default' => 0
),
'fictioneer_enable_patreon_locks' => array(
'name' => 'fictioneer_enable_patreon_locks',
'group' => 'fictioneer-settings-general-group',
@ -1061,6 +1067,7 @@ function fictioneer_get_option_label( $option ) {
'fictioneer_count_characters_as_words' => __( 'Count characters instead of words', 'fictioneer' ),
'fictioneer_show_protected_excerpt' => __( 'Show excerpt on password-protected posts', 'fictioneer' ),
'fictioneer_hide_large_card_chapter_list' => __( 'Hide chapter list on large story cards', 'fictioneer' ),
'fictioneer_show_story_cards_latest_chapters' => __( 'Show latest chapter on large story cards', 'fictioneer' ),
'fictioneer_enable_patreon_locks' => __( 'Enable Patreon content gate', 'fictioneer' ),
'fictioneer_hide_password_form_with_patreon' => __( 'Hide password form on Patreon-gated posts', 'fictioneer' ),
'fictioneer_user_profile_page' => __( 'Account page assignment', 'fictioneer' ),

View File

@ -305,6 +305,16 @@
?>
</div>
<div class="fictioneer-card__row">
<?php
fictioneer_settings_label_checkbox(
'fictioneer_show_story_cards_latest_chapters',
__( 'Show latest chapter on large story cards', 'fictioneer' ),
__( 'Instead of the first three to avoid spoilers.', 'fictioneer' )
);
?>
</div>
<div class="fictioneer-card__row">
<?php
fictioneer_settings_label_checkbox(