Add option to show modified date on stories

Instead of the publish date.
This commit is contained in:
Tetrakern 2024-10-05 16:24:41 +02:00
parent 155b9b9d78
commit 7aba027729
3 changed files with 24 additions and 2 deletions

View File

@ -719,6 +719,12 @@ define( 'FICTIONEER_OPTIONS', array(
'group' => 'fictioneer-settings-general-group',
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
'default' => 0
),
'fictioneer_show_story_modified_date' => array(
'name' => 'fictioneer_show_story_modified_date',
'group' => 'fictioneer-settings-general-group',
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
'default' => 0
)
),
'integers' => array(
@ -1190,6 +1196,7 @@ function fictioneer_get_option_label( $option ) {
'fictioneer_log_posts' => __( 'Log all post updates', 'fictioneer' ),
'fictioneer_disable_menu_transients' => __( 'Disable menu Transient caching', 'fictioneer' ),
'fictioneer_enable_line_break_fix' => __( 'Enable fixing of chapter paragraphs', 'fictioneer' ),
'fictioneer_show_story_modified_date' => __( 'Show the modified date on story pages', 'fictioneer' ),
);
}

View File

@ -342,6 +342,16 @@ $images = get_template_directory_uri() . '/img/documentation/';
?>
</div>
<div class="fictioneer-card__row">
<?php
fictioneer_settings_label_checkbox(
'fictioneer_show_story_modified_date',
__( 'Show the modified date on story pages', 'fictioneer' ),
__( 'Below the chapter list and instead of the publish date.', 'fictioneer' )
);
?>
</div>
<div class="fictioneer-card__row">
<?php
fictioneer_settings_label_checkbox(

View File

@ -35,8 +35,13 @@ $meta_output = [];
// Status
$meta_output['status'] = '<span class="story__meta-item story__status"><i class="' . $story['icon'] . '"></i> ' . fcntr( $story['status'] ) . '</span>';
// Date
$meta_output['date'] = '<span class="story__meta-item story__date _published" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"><i class="fa-solid fa-clock"></i> <span class="hide-below-480">' . get_the_time( get_option( 'date_format' ), $post ) . '</span><span class="show-below-480">' . get_the_time( FICTIONEER_STORY_FOOTER_B480_DATE, $post ) . '</span></span>';
if ( get_option( 'fictioneer_show_story_modified_date' ) ) {
// Modified
$meta_output['modified'] = '<span class="story__meta-item story__date _modified" title="' . esc_attr__( 'Updated', 'fictioneer' ) . '"><i class="fa-regular fa-clock"></i> <span class="hide-below-480">' . get_the_modified_date( get_option( 'date_format' ), $post ) . '</span><span class="show-below-480">' . get_the_modified_date( FICTIONEER_STORY_FOOTER_B480_DATE, $post ) . '</span></span>';
} else {
// Publish
$meta_output['date'] = '<span class="story__meta-item story__date _published" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"><i class="fa-solid fa-clock"></i> <span class="hide-below-480">' . get_the_time( get_option( 'date_format' ), $post ) . '</span><span class="show-below-480">' . get_the_time( FICTIONEER_STORY_FOOTER_B480_DATE, $post ) . '</span></span>';
}
// Words
$meta_output['words'] = '<span class="story__meta-item story__words" title="' . esc_attr__( 'Total Words', 'fictioneer' ) . '"><i class="fa-solid fa-font"></i> ' . $story['word_count_short'] . '</span>';