%1$s%2$s %4$s',
get_avatar( get_the_author_meta( 'user_email' ), $author_avatar_size ),
/* translators: Hidden accessibility text. */
_x( 'Author', 'Used before post author name.', 'twentysixteen' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
get_the_author()
);
}
if ( in_array( get_post_type(), array( 'post', 'attachment' ), true ) ) {
twentysixteen_entry_date();
}
$format = get_post_format();
if ( current_theme_supports( 'post-formats', $format ) ) {
printf(
'%1$s%3$s',
sprintf(
'%s ',
/* translators: Hidden accessibility text. */
_x( 'Format', 'Used before post format.', 'twentysixteen' )
),
esc_url( get_post_format_link( $format ) ),
get_post_format_string( $format )
);
}
if ( 'post' === get_post_type() ) {
twentysixteen_entry_taxonomies();
}
if ( ! is_singular() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
/* translators: %s: Post title. Only visible to screen readers. */
comments_popup_link( sprintf( __( 'Leave a comment on %s', 'twentysixteen' ), get_the_title() ) );
echo '';
}
}
endif;
if ( ! function_exists( 'twentysixteen_entry_date' ) ) :
/**
* Prints HTML with date information for current post.
*
* Create your own twentysixteen_entry_date() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_entry_date() {
$time_string = '';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( 'c' ) ),
get_the_date(),
esc_attr( get_the_modified_date( 'c' ) ),
get_the_modified_date()
);
printf(
'%1$s %3$s',
/* translators: Hidden accessibility text. */
_x( 'Posted on', 'Used before publish date.', 'twentysixteen' ),
esc_url( get_permalink() ),
$time_string
);
}
endif;
if ( ! function_exists( 'twentysixteen_entry_taxonomies' ) ) :
/**
* Prints HTML with category and tags for current post.
*
* Create your own twentysixteen_entry_taxonomies() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_entry_taxonomies() {
$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
if ( $categories_list && twentysixteen_categorized_blog() ) {
printf(
'%1$s %2$s',
/* translators: Hidden accessibility text. */
_x( 'Categories', 'Used before category names.', 'twentysixteen' ),
$categories_list
);
}
$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
if ( $tags_list && ! is_wp_error( $tags_list ) ) {
printf(
'%1$s %2$s',
/* translators: Hidden accessibility text. */
_x( 'Tags', 'Used before tag names.', 'twentysixteen' ),
$tags_list
);
}
}
endif;
if ( ! function_exists( 'twentysixteen_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
* Create your own twentysixteen_post_thumbnail() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
%2$s',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Post title. Only visible to screen readers. */
sprintf( __( 'Continue reading "%s"', 'twentysixteen' ), get_the_title( get_the_ID() ) )
);
return ' … ' . $link;
}
add_filter( 'excerpt_more', 'twentysixteen_excerpt_more' );
endif;
if ( ! function_exists( 'twentysixteen_categorized_blog' ) ) :
/**
* Determines whether blog/site has more than one category.
*
* Create your own twentysixteen_categorized_blog() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*
* @return bool True if there is more than one category, false otherwise.
*/
function twentysixteen_categorized_blog() {
$all_the_cool_cats = get_transient( 'twentysixteen_categories' );
if ( false === $all_the_cool_cats ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories(
array(
'fields' => 'ids',
// We only need to know if there is more than one category.
'number' => 2,
)
);
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0;
set_transient( 'twentysixteen_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 || is_preview() ) {
// This blog has more than 1 category so twentysixteen_categorized_blog() should return true.
return true;
} else {
// This blog has only 1 category so twentysixteen_categorized_blog() should return false.
return false;
}
}
endif;
/**
* Flushes out the transients used in twentysixteen_categorized_blog().
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'twentysixteen_categories' );
}
add_action( 'edit_category', 'twentysixteen_category_transient_flusher' );
add_action( 'save_post', 'twentysixteen_category_transient_flusher' );
if ( ! function_exists( 'twentysixteen_the_custom_logo' ) ) :
/**
* Displays the optional custom logo.
*
* Does nothing if the custom logo is not available.
*
* @since Twenty Sixteen 1.2
*/
function twentysixteen_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
}
endif;
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backward compatibility to support pre-5.2.0 WordPress versions.
*
* @since Twenty Sixteen 2.0
*/
function wp_body_open() {
/**
* Triggered after the opening tag.
*
* @since Twenty Sixteen 2.0
*/
do_action( 'wp_body_open' );
}
endif;