Skip to content

Commit 03a7d19

Browse files
committed
fix date format using wordpress settings
1 parent 2c8cb35 commit 03a7d19

7 files changed

Lines changed: 11 additions & 7 deletions

File tree

inc/class-cc-site.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,8 @@ public static function get_parent_page() {
160160
return $post->ID;
161161
}
162162
}
163+
public static function get_date_format() {
164+
$date_format = apply_filters('cc_theme_base_date_format', get_option( 'date_format' ) );
165+
return $date_format;
166+
}
163167
}

inc/class-components.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static function card_post(
6868
$card_image = ( $use_post_data ) ? get_the_post_thumbnail( $post_id, 'landscape-medium' ) : wp_get_attachment_image( $image_id, 'landscape-medium' );
6969
$card_title = ( $use_post_data ) ? get_the_title( $post_id ) : $title;
7070
$card_url = ( $use_post_data ) ? get_permalink( $post_id ) : $url;
71-
$card_date = ( $use_post_data ) ? get_the_date( 'd F Y', $post_id ) : $date;
71+
$card_date = ( $use_post_data ) ? get_the_date( CC_Site::get_date_format(), $post_id ) : $date;
7272
$card_border = ( $has_border ) ? '' : ' no-border ';
7373
$button_color = ( $button_color ) ? $button_color : 'is-primary';
7474
$button_size = ( $button_size ) ? $button_size : 'big';
@@ -358,7 +358,7 @@ public static function simple_entry( $post_id, $has_content = true, $has_image =
358358
}
359359
$out .= '<div class="entry-content column">';
360360
$out .= '<h4 class="b-header"><a href="' . get_permalink( $post_id ) . '">' . get_the_title( $post_id ) . '</a></h4>';
361-
$out .= '<span class="entry-date">' . get_the_date( 'd F Y' ) . '</span>';
361+
$out .= '<span class="entry-date">' . get_the_date( CC_Site::get_date_format() ) . '</span>';
362362
if ( $has_content ) {
363363
$the_post = get_post( $post_id );
364364
$out .= '<div class="entry-description">';

inc/partials/entry/entry-author.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
the_author_posts_link();
4040
}
4141
echo '</div>';
42-
echo '<div class="author-date">'. get_the_date( 'F d, Y' ); '</div>';
42+
echo '<div class="author-date">'. get_the_date( CC_Site::get_date_format() ); '</div>';
4343
echo '</div>';
4444
echo '</div>';
4545
echo '</div>';

inc/partials/post_formats/content-default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
if ( $settings['show_authors'] ) {
66
get_template_part( 'inc/partials/entry/entry','author' );
77
} else {
8-
echo '<span class="entry-date">'. get_the_date( 'F d, Y' ) .'</span>';
8+
echo '<span class="entry-date">'. get_the_date( CC_Site::get_date_format() ) .'</span>';
99
}
1010
?>
1111
<?php

inc/partials/post_formats/content-gallery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
if ( $settings['show_authors'] ) {
2626
get_template_part( 'inc/partials/entry/entry','author' );
2727
} else {
28-
echo '<span class="entry-date">'. get_the_date( 'F d, Y' ) .'</span>';
28+
echo '<span class="entry-date">'. get_the_date( CC_Site::get_date_format() ) .'</span>';
2929
}
3030
?>
3131
<?php

inc/partials/post_formats/content-image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if ( $settings['show_authors'] ) {
1313
get_template_part( 'inc/partials/entry/entry','author' );
1414
} else {
15-
echo '<span class="entry-date">'. get_the_date( 'F d, Y' ) .'</span>';
15+
echo '<span class="entry-date">'. get_the_date( CC_Site::get_date_format() ) .'</span>';
1616
}
1717
?>
1818
<?php

inc/partials/post_formats/content-video.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
if ( $settings['show_authors'] ) {
1616
get_template_part( 'inc/partials/entry/entry','author' );
1717
} else {
18-
echo '<span class="entry-date">'. get_the_date( 'F d, Y' ) .'</span>';
18+
echo '<span class="entry-date">'. get_the_date( CC_Site::get_date_format() ) .'</span>';
1919
}
2020
?>
2121
<?php

0 commit comments

Comments
 (0)