update template-tags

This commit is contained in:
koenemann 2017-02-07 15:23:13 +01:00
parent 004a279dea
commit 5ae85ca5fa
1 changed files with 9 additions and 17 deletions

View File

@ -14,28 +14,23 @@ if ( ! function_exists( 'understrap_posted_on' ) ) :
function understrap_posted_on() { function understrap_posted_on() {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>, <time class="updated" datetime="%3$s">' . __( ' Edited %4$s', 'understrap' ) . '</time>'; $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
} }
$time_string = sprintf( $time_string, $time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ), esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ), esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ), esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() ) esc_html( get_the_modified_date() )
); );
$posted_on = sprintf( $posted_on = sprintf(
esc_html_x( 'Posted on %s', 'post date', 'understrap' ), esc_html_x( 'Posted on %s', 'post date', 'understrap' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>' '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
); );
$byline = sprintf( $byline = sprintf(
esc_html_x( 'by %s', 'post author', 'understrap' ), esc_html_x( 'by %s', 'post author', 'understrap' ),
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>' '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
); );
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
} }
endif; endif;
@ -45,26 +40,23 @@ if ( ! function_exists( 'understrap_entry_footer' ) ) :
*/ */
function understrap_entry_footer() { function understrap_entry_footer() {
// Hide category and tag text for pages. // Hide category and tag text for pages.
if ( 'post' == get_post_type() ) { if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */ /* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'understrap' ) ); $categories_list = get_the_category_list( esc_html__( ', ', 'understrap' ) );
if ( $categories_list && understrap_categorized_blog() ) { if ( $categories_list && understrap_categorized_blog() ) {
printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'understrap' ) . '</span>', $categories_list ); printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'understrap' ) . '</span>', $categories_list ); // WPCS: XSS OK.
} }
/* translators: used between list items, there is a space after the comma */ /* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', __( ', ', 'understrap' ) ); $tags_list = get_the_tag_list( '', esc_html__( ', ', 'understrap' ) );
if ( $tags_list ) { if ( $tags_list ) {
printf( '<span class="tags-links">' . __( 'Tagged %1$s', 'understrap' ) . '</span>', $tags_list ); printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'understrap' ) . '</span>', $tags_list ); // WPCS: XSS OK.
} }
} }
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">'; echo '<span class="comments-link">';
comments_popup_link( __( 'Leave a comment', 'understrap' ), __( '1 Comment', 'understrap' ), __( '% Comments', 'understrap' ) ); comments_popup_link( esc_html__( 'Leave a comment', 'understrap' ), esc_html__( '1 Comment', 'understrap' ), esc_html__( '% Comments', 'understrap' ) );
echo '</span>'; echo '</span>';
} }
edit_post_link( edit_post_link(
sprintf( sprintf(
/* translators: %s: Name of current post */ /* translators: %s: Name of current post */