Update date strings

And add more constants.
This commit is contained in:
Tetrakern 2023-06-06 22:01:29 +02:00
parent ad6d54482d
commit 23d019dec3
9 changed files with 67 additions and 20 deletions

View File

@ -70,24 +70,71 @@ if ( ! defined( 'FICTIONEER_SITE_DESCRIPTION' ) ) {
define( 'FICTIONEER_SITE_DESCRIPTION', get_bloginfo( 'description' ) );
}
/*
* Date Strings
*/
$short_date = get_option( 'fictioneer_subitem_short_date_format', 'M j' ) ?: 'M j';
$long_date = get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y";
// String: Latest Updates shortcode list item date format
if ( ! defined( 'FICTIONEER_LATEST_UPDATES_LI_DATE' ) ) {
define( 'FICTIONEER_LATEST_UPDATES_LI_DATE', get_option( 'fictioneer_subitem_short_date_format', 'M j' ) ?: 'M j' );
define( 'FICTIONEER_LATEST_UPDATES_LI_DATE', $short_date );
}
// String: Latest Updates shortcode footer date format
if ( ! defined( 'FICTIONEER_LATEST_UPDATES_FOOTER_DATE' ) ) {
define( 'FICTIONEER_LATEST_UPDATES_FOOTER_DATE', get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" );
define( 'FICTIONEER_LATEST_UPDATES_FOOTER_DATE', $long_date );
}
// String: Latest Chapters shortcode footer date format
if ( ! defined( 'FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE' ) ) {
define( 'FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE', get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" );
define( 'FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE', $long_date );
}
// String: Latest Stories shortcode footer date format
if ( ! defined( 'FICTIONEER_LATEST_STORIES_FOOTER_DATE' ) ) {
define( 'FICTIONEER_LATEST_STORIES_FOOTER_DATE', get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" );
define( 'FICTIONEER_LATEST_STORIES_FOOTER_DATE', $long_date );
}
// String: Story card footer date format
if ( ! defined( 'FICTIONEER_CARD_STORY_FOOTER_DATE' ) ) {
define( 'FICTIONEER_CARD_STORY_FOOTER_DATE', $long_date );
}
// String: Story card list item date format
if ( ! defined( 'FICTIONEER_CARD_STORY_LI_DATE' ) ) {
define( 'FICTIONEER_CARD_STORY_LI_DATE', $long_date );
}
// String: Chapter card footer date format
if ( ! defined( 'FICTIONEER_CARD_CHAPTER_FOOTER_DATE' ) ) {
define( 'FICTIONEER_CARD_CHAPTER_FOOTER_DATE', $long_date );
}
// String: Collection card footer date format
if ( ! defined( 'FICTIONEER_CARD_COLLECTION_FOOTER_DATE' ) ) {
define( 'FICTIONEER_CARD_COLLECTION_FOOTER_DATE', $long_date );
}
// String: Collection card list item date format
if ( ! defined( 'FICTIONEER_CARD_COLLECTION_LI_DATE' ) ) {
define( 'FICTIONEER_CARD_COLLECTION_LI_DATE', $long_date );
}
// String: Post card footer date format
if ( ! defined( 'FICTIONEER_CARD_POST_FOOTER_DATE' ) ) {
define( 'FICTIONEER_CARD_POST_FOOTER_DATE', $long_date );
}
// String: Page card footer date format
if ( ! defined( 'FICTIONEER_CARD_PAGE_FOOTER_DATE' ) ) {
define( 'FICTIONEER_CARD_PAGE_FOOTER_DATE', $long_date );
}
// String: Story page footer date format below 480px
if ( ! defined( 'FICTIONEER_STORY_FOOTER_B480_DATE' ) ) {
define( 'FICTIONEER_STORY_FOOTER_B480_DATE', $long_date );
}
/*

View File

@ -1169,7 +1169,7 @@ if ( ! function_exists( 'fictioneer_get_post_meta_items' ) ) {
ob_start();
// Start HTML ---> ?>
<time datetime="<?php the_time( 'c' ); ?>" class="post__date">
<i class="fa-solid fa-clock" title="<?php esc_attr_e( 'Publishing Date', 'fictioneer' ) ?>"></i>
<i class="fa-solid fa-clock" title="<?php esc_attr_e( 'Published', 'fictioneer' ) ?>"></i>
<?php echo get_the_date(); ?>
</time>
<?php // <--- End HTML

View File

@ -124,7 +124,7 @@ $show_type = isset( $args['show_type'] ) && $args['show_type'];
<div class="card__right">
<?php
echo $story_data['word_count_short'];
echo '<span class="hide-below-480">';
echo ' <span class="hide-below-480">';
echo __( 'Words', 'fictioneer' );
echo '</span><span class="separator-dot">&#8196;&bull;&#8196;</span>';
echo $story_data['status'];
@ -178,8 +178,8 @@ $show_type = isset( $args['show_type'] ) && $args['show_type'];
<i class="fa-solid fa-font" title="<?php esc_attr_e( 'Words', 'fictioneer' ) ?>"></i>
<?php echo fictioneer_shorten_number( get_post_meta( get_the_ID(), '_word_count', true ) ); ?>
<i class="fa-regular fa-clock" title="<?php esc_attr_e( 'Last Updated', 'fictioneer' ) ?>"></i>
<?php the_modified_date( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" ); ?>
<i class="fa-solid fa-clock" title="<?php esc_attr_e( 'Published', 'fictioneer' ) ?>"></i>
<?php echo get_the_date( FICTIONEER_CARD_CHAPTER_FOOTER_DATE ); ?>
<?php if ( get_option( 'fictioneer_show_authors' ) && ! $hide_author ) : ?>
<?php fictioneer_icon( 'user', 'hide-below-desktop' ); ?>

View File

@ -129,7 +129,7 @@ $comment_count = get_comments( $comment_args );
<?php
echo get_post_type_object( get_post_type( $post_id ) )->labels->singular_name;
echo '<span class="separator-dot hide-below-480">&#8196;&bull;&#8196;</span><span class="hide-below-480">';
echo get_post_time( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y", false, $post_id );
echo get_the_modified_date( FICTIONEER_CARD_COLLECTION_LI_DATE, $post_id );
echo '</span>';
?>
</div>
@ -188,7 +188,7 @@ $comment_count = get_comments( $comment_args );
<?php echo fictioneer_shorten_number( $word_count ); ?>
<i class="fa-regular fa-clock" title="<?php esc_attr_e( 'Last Updated', 'fictioneer' ) ?>"></i>
<?php the_modified_date( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" ); ?>
<?php the_modified_date( FICTIONEER_CARD_COLLECTION_FOOTER_DATE ); ?>
<i class="fa-solid fa-message" title="<?php esc_attr_e( 'Comments', 'fictioneer' ) ?>"></i>
<?php echo $comment_count; ?>

View File

@ -51,8 +51,8 @@ $comments_number = get_comments_number();
<?php fictioneer_icon( 'user' ); ?>
<?php fictioneer_the_author_node( get_the_author_meta( 'ID' ) ); ?>
<?php endif; ?>
<i class="fa-solid fa-clock" title="<?php esc_attr_e( 'Publishing Date', 'fictioneer' ) ?>"></i>
<?php the_time( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" ); ?>
<i class="fa-solid fa-clock" title="<?php esc_attr_e( 'Published', 'fictioneer' ) ?>"></i>
<?php the_time( FICTIONEER_CARD_PAGE_FOOTER_DATE ); ?>
<?php if ( $comments_number > 0 ) : ?>
<i class="fa-solid fa-message" title="<?php esc_attr_e( 'Comments', 'fictioneer' ) ?>"></i>
<?php echo $comments_number; ?>

View File

@ -75,8 +75,8 @@ $show_type = isset( $args['show_type'] ) && $args['show_type'];
<?php fictioneer_icon( 'user' ); ?>
<?php fictioneer_the_author_node( get_the_author_meta( 'ID' ) ); ?>
<?php endif; ?>
<i class="fa-solid fa-clock" title="<?php esc_attr_e( 'Publishing Date', 'fictioneer' ) ?>"></i>
<?php the_time( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" ); ?>
<i class="fa-solid fa-clock" title="<?php esc_attr_e( 'Published', 'fictioneer' ) ?>"></i>
<?php the_time( FICTIONEER_CARD_POST_FOOTER_DATE ); ?>
<i class="fa-solid fa-message" title="<?php esc_attr_e( 'Comments', 'fictioneer' ) ?>"></i>
<?php echo get_comments_number(); ?>
</div>

View File

@ -102,7 +102,7 @@ $show_type = isset( $args['show_type'] ) && $args['show_type'];
if ( strtotime( '-1 days' ) < strtotime( get_the_date( '', $id ) ) ) {
_e( 'New', 'fictioneer' );
} else {
echo get_the_time( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y", $id );
echo get_the_time( FICTIONEER_CARD_STORY_LI_DATE, $id );
}
?>
</div>
@ -159,7 +159,7 @@ $show_type = isset( $args['show_type'] ) && $args['show_type'];
<?php echo $story['word_count_short']; ?>
<i class="fa-regular fa-clock" title="<?php esc_attr_e( 'Last Updated', 'fictioneer' ) ?>"></i>
<?php the_modified_date( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" ); ?>
<?php the_modified_date( FICTIONEER_CARD_STORY_FOOTER_DATE ); ?>
<?php if ( get_option( 'fictioneer_show_authors' ) && ! $hide_author ) : ?>
<?php fictioneer_icon( 'user', 'hide-below-desktop' ); ?>

View File

@ -147,8 +147,8 @@ $entries = new WP_Query( $query_args );
<i class="fa-solid fa-font" title="<?php esc_attr_e( 'Words', 'fictioneer' ) ?>"></i>
<?php echo fictioneer_shorten_number( get_post_meta( $post->ID, '_word_count', true ) ); ?>
<i class="fa-regular fa-clock" title="<?php esc_attr_e( 'Last Updated', 'fictioneer' ) ?>"></i>
<?php echo get_the_time( FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE ); ?>
<i class="fa-solid fa-clock" title="<?php esc_attr_e( 'Published', 'fictioneer' ) ?>"></i>
<?php echo get_the_date( FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE ); ?>
<i class="fa-solid fa-message" title="<?php esc_attr_e( 'Comments', 'fictioneer' ) ?>"></i>
<?php echo get_comments_number(); ?>

View File

@ -38,10 +38,10 @@ $story = $args['story_data'];
<i class="<?php echo $story['icon']; ?>"></i>
<?php echo $story['status']; ?>
</span>
<span class="story__date _published" title="<?php esc_attr_e( 'Publishing Date', 'fictioneer' ) ?>">
<span class="story__date _published" title="<?php esc_attr_e( 'Published', 'fictioneer' ) ?>">
<i class="fa-solid fa-clock"></i>
<span class="hide-below-480"><?php the_time( get_option( 'date_format' ) ); ?></span>
<span class="show-below-480"><?php the_time( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" ); ?></span>
<span class="show-below-480"><?php the_time( FICTIONEER_STORY_FOOTER_B480_DATE ); ?></span>
</span>
<span class="story__words" title="<?php esc_attr_e( 'Total Words', 'fictioneer' ) ?>">
<i class="fa-solid fa-font"></i>