Created
June 20, 2019 04:33
-
-
Save TanvirAmi/9fe0b50575a0896dae25cde02f97af06 to your computer and use it in GitHub Desktop.
Added publish date for page in beginner theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get the customizer value. | |
$title = beginner_mod( PREFIX . 'page-title' ); | |
?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php hybrid_attr( 'post' ); ?>> | |
<?php if ( $title ) : ?> | |
<?php the_title( '<h1 class="page-title" ' . hybrid_get_attr( 'entry-title' ) . '>', '</h1>' ); ?> | |
<?php endif; ?> | |
<?php | |
// post date | |
if ( 'published' == $date_type ) { | |
$datestamp = get_the_date(); | |
$timestamp = get_the_time( 'U' ); | |
$datetime = get_the_date( 'c' ); | |
} else { | |
$datestamp = get_the_modified_date(); | |
$timestamp = get_the_modified_time( 'U' ); | |
$datetime = get_the_modified_date( 'c' ); | |
} | |
if ( 'absolute' == $date_style ) { | |
$date_string = esc_html( $datestamp ); | |
} else { | |
$date_string = sprintf( esc_html__( '%s ago', 'beginner' ), human_time_diff( $timestamp, current_time( 'timestamp' ) ) ); | |
} | |
$time_string = sprintf( '<time datetime="%1$s">%2$s</time>', | |
esc_attr( $datetime ), | |
$date_string | |
); | |
printf( _x( '<span class="post-date">Last Updated: %1$s</span>', 'post meta', 'beginner' ), $time_string ); | |
?> | |
<div class="entry-content" <?php hybrid_attr( 'entry-content' ); ?>> | |
<?php the_content(); ?> | |
<?php | |
wp_link_pages( array( | |
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'beginner' ), | |
'after' => '</div>', | |
) ); | |
?> | |
</div><!-- .entry-content --> | |
<?php edit_post_link( esc_html__( 'Edit', 'beginner' ), '<footer class="entry-footer"><span class="edit-link">', '</span></footer>' ); ?> | |
</article><!-- #post-## --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment