Add the date and author above the categories and other footer entry meta
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 | |
if ( ! function_exists( 'generate_entry_meta' ) ) : | |
/** | |
* Prints HTML with meta information for the categories, tags. | |
* | |
* @since 1.2.5 | |
*/ | |
function generate_entry_meta() | |
{ | |
$categories = apply_filters( 'generate_show_categories', true ); | |
$tags = apply_filters( 'generate_show_tags', true ); | |
$comments = apply_filters( 'generate_show_comments', true ); | |
$date = apply_filters( 'generate_post_date', true ); | |
$author = apply_filters( 'generate_post_author', true ); | |
if ( 'post' == get_post_type() ) { | |
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>'; | |
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) | |
$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>'; | |
$time_string = sprintf( $time_string, | |
esc_attr( get_the_date( 'c' ) ), | |
esc_html( get_the_date() ), | |
esc_attr( get_the_modified_date( 'c' ) ), | |
esc_html( get_the_modified_date() ) | |
); | |
// If our date is enabled, show it | |
if ( $date ) : | |
printf( '<span class="posted-on">%1$s</span>', | |
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>', | |
esc_url( get_permalink() ), | |
esc_attr( get_the_time() ), | |
$time_string | |
) | |
); | |
endif; | |
// If our author is enabled, show it | |
if ( $author ) : | |
printf( ' <span class="byline">%1$s</span>', | |
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>', | |
__( 'by','generate'), | |
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), | |
esc_attr( sprintf( __( 'View all posts by %s', 'generate' ), get_the_author() ) ), | |
esc_html( get_the_author() ) | |
) | |
); | |
endif; | |
$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generate' ) ); | |
if ( $categories_list && $categories ) { | |
printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', | |
_x( 'Categories', 'Used before category names.', 'generate' ), | |
$categories_list | |
); | |
} | |
$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generate' ) ); | |
if ( $tags_list && $tags ) { | |
printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', | |
_x( 'Tags', 'Used before tag names.', 'generate' ), | |
$tags_list | |
); | |
} | |
} | |
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) && $comments ) { | |
echo '<span class="comments-link">'; | |
comments_popup_link( __( 'Leave a comment', 'generate' ), __( '1 Comment', 'generate' ), __( '% Comments', 'generate' ) ); | |
echo '</span>'; | |
} | |
} | |
endif; | |
if ( ! function_exists( 'generate_posted_on' ) ) : | |
/** | |
* Prints HTML with meta information for the current post-date/time and author. | |
*/ | |
function generate_posted_on() { | |
return ''; | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment