From 23d019dec3f53e6df64f212909cae74d1a56a46c Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Tue, 6 Jun 2023 22:01:29 +0200 Subject: [PATCH] Update date strings And add more constants. --- functions.php | 55 +++++++++++++++++++++++-- includes/functions/_content_helpers.php | 2 +- partials/_card-chapter.php | 6 +-- partials/_card-collection.php | 4 +- partials/_card-page.php | 4 +- partials/_card-post.php | 4 +- partials/_card-story.php | 4 +- partials/_latest-chapters.php | 4 +- partials/_story-footer.php | 4 +- 9 files changed, 67 insertions(+), 20 deletions(-) diff --git a/functions.php b/functions.php index 03788de7..700510f3 100644 --- a/functions.php +++ b/functions.php @@ -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 ); } /* diff --git a/includes/functions/_content_helpers.php b/includes/functions/_content_helpers.php index e521df04..c455cd7c 100644 --- a/includes/functions/_content_helpers.php +++ b/includes/functions/_content_helpers.php @@ -1169,7 +1169,7 @@ if ( ! function_exists( 'fictioneer_get_post_meta_items' ) ) { ob_start(); // Start HTML ---> ?> '; + echo ' '; echo __( 'Words', 'fictioneer' ); echo ' • '; echo $story_data['status']; @@ -178,8 +178,8 @@ $show_type = isset( $args['show_type'] ) && $args['show_type']; - - + + diff --git a/partials/_card-collection.php b/partials/_card-collection.php index 3db4fc01..c68f32da 100644 --- a/partials/_card-collection.php +++ b/partials/_card-collection.php @@ -129,7 +129,7 @@ $comment_count = get_comments( $comment_args ); labels->singular_name; echo ' • '; - 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 ''; ?> @@ -188,7 +188,7 @@ $comment_count = get_comments( $comment_args ); - + diff --git a/partials/_card-page.php b/partials/_card-page.php index 72dcae0e..8584dfff 100644 --- a/partials/_card-page.php +++ b/partials/_card-page.php @@ -51,8 +51,8 @@ $comments_number = get_comments_number(); - - + + 0 ) : ?> diff --git a/partials/_card-post.php b/partials/_card-post.php index c33b46ec..1da1f53e 100644 --- a/partials/_card-post.php +++ b/partials/_card-post.php @@ -75,8 +75,8 @@ $show_type = isset( $args['show_type'] ) && $args['show_type']; - - + + diff --git a/partials/_card-story.php b/partials/_card-story.php index e1be4b80..81aa1e06 100644 --- a/partials/_card-story.php +++ b/partials/_card-story.php @@ -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 ); } ?> @@ -159,7 +159,7 @@ $show_type = isset( $args['show_type'] ) && $args['show_type']; - + diff --git a/partials/_latest-chapters.php b/partials/_latest-chapters.php index eb4e2b20..9aa9846a 100644 --- a/partials/_latest-chapters.php +++ b/partials/_latest-chapters.php @@ -147,8 +147,8 @@ $entries = new WP_Query( $query_args ); ID, '_word_count', true ) ); ?> - - + + diff --git a/partials/_story-footer.php b/partials/_story-footer.php index 17795724..3b3f158c 100644 --- a/partials/_story-footer.php +++ b/partials/_story-footer.php @@ -38,10 +38,10 @@ $story = $args['story_data']; - + - +