diff options
Diffstat (limited to 'themes/twentyfifteen/inc/template-tags.php')
-rw-r--r-- | themes/twentyfifteen/inc/template-tags.php | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/themes/twentyfifteen/inc/template-tags.php b/themes/twentyfifteen/inc/template-tags.php index 6af6e750..b2b515f4 100644 --- a/themes/twentyfifteen/inc/template-tags.php +++ b/themes/twentyfifteen/inc/template-tags.php @@ -23,13 +23,15 @@ if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) : <h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfifteen' ); ?></h2> <div class="nav-links"> <?php - if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) : + $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ); + if ( $prev_link ) { printf( '<div class="nav-previous">%s</div>', $prev_link ); - endif; + } - if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) : + $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ); + if ( $next_link ) { printf( '<div class="nav-next">%s</div>', $next_link ); - endif; + } ?> </div><!-- .nav-links --> </nav><!-- .comment-navigation --> @@ -59,7 +61,7 @@ if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) : ); } - if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) { + if ( in_array( get_post_type(), array( 'post', 'attachment' ), true ) ) { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { @@ -82,7 +84,7 @@ if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) : ); } - if ( 'post' == get_post_type() ) { + if ( 'post' === get_post_type() ) { if ( is_singular() || is_multi_author() ) { printf( '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', @@ -126,7 +128,7 @@ if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) : if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">'; - /* translators: %s: post title */ + /* translators: %s: Post title. */ comments_popup_link( sprintf( __( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen' ), get_the_title() ) ); echo '</span>'; } @@ -141,7 +143,8 @@ endif; * @return bool True of there is more than one category, false otherwise. */ function twentyfifteen_categorized_blog() { - if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ) ) ) { + $all_the_cool_cats = get_transient( 'twentyfifteen_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( @@ -160,10 +163,10 @@ function twentyfifteen_categorized_blog() { } if ( $all_the_cool_cats > 1 || is_preview() ) { - // This blog has more than 1 category so twentyfifteen_categorized_blog should return true. + // This blog has more than 1 category so twentyfifteen_categorized_blog() should return true. return true; } else { - // This blog has only 1 category so twentyfifteen_categorized_blog should return false. + // This blog has only 1 category so twentyfifteen_categorized_blog() should return false. return false; } } @@ -210,7 +213,7 @@ if ( ! function_exists( 'twentyfifteen_post_thumbnail' ) ) : </a> <?php - endif; // End is_singular() + endif; // End is_singular(). } endif; @@ -245,7 +248,7 @@ if ( ! function_exists( 'twentyfifteen_excerpt_more' ) && ! is_admin() ) : $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>', esc_url( get_permalink( get_the_ID() ) ), - /* translators: %s: Name of current post */ + /* translators: %s: Post title. */ sprintf( __( 'Continue reading %s', 'twentyfifteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' ) ); return ' … ' . $link; @@ -272,7 +275,7 @@ if ( ! function_exists( 'wp_body_open' ) ) : /** * Fire the wp_body_open action. * - * Added for backwards compatibility to support pre 5.2.0 WordPress versions. + * Added for backward compatibility to support pre-5.2.0 WordPress versions. * * @since Twenty Fifteen 2.5 */ |