Compare commits

...
This repository has been archived on 2020-05-08. You can view files and clone it, but cannot push or open issues or pull requests.

3 Commits

Author SHA1 Message Date
Yoav Farhi b2880f537e some CS 2018-04-08 11:19:51 +03:00
Yoav Farhi 6af98e3e3b remove context 2018-04-08 11:11:14 +03:00
Yoav Farhi 43bc383c26 replace _s_posted_on and _s_posted_by with _s_posted_on_by for better i18n 2018-04-08 11:07:55 +03:00
3 changed files with 10 additions and 29 deletions

View File

@ -7,11 +7,12 @@
* @package _s * @package _s
*/ */
if ( ! function_exists( '_s_posted_on' ) ) : if ( ! function_exists( '_s_posted_on_by' ) ) :
/** /**
* Prints HTML with meta information for the current post-date/time. * Prints HTML with meta information for the current post-date/time and current author.
*/ */
function _s_posted_on() { function _s_posted_on_by() {
$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">%4$s</time>'; $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
@ -24,30 +25,12 @@ if ( ! function_exists( '_s_posted_on' ) ) :
esc_html( get_the_modified_date() ) esc_html( get_the_modified_date() )
); );
$posted_on = sprintf( printf(
/* translators: %s: post date. */ /* translators: %1$s: post date, %2$s: post author . */
esc_html_x( 'Posted on %s', 'post date', '_s' ), __( '<span class="posted-on">Posted on %1$s</span> <span class="byline">by %2$s</span>', '_s' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>' '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>', // WPCS: XSS OK.
);
echo '<span class="posted-on">' . $posted_on . '</span>'; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( '_s_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function _s_posted_by() {
$byline = sprintf(
/* translators: %s: post author. */
esc_html_x( 'by %s', 'post author', '_s' ),
'<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="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
} }
endif; endif;

View File

@ -16,8 +16,7 @@
<?php if ( 'post' === get_post_type() ) : ?> <?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta"> <div class="entry-meta">
<?php <?php
_s_posted_on(); _s_posted_on_by()
_s_posted_by();
?> ?>
</div><!-- .entry-meta --> </div><!-- .entry-meta -->
<?php endif; ?> <?php endif; ?>

View File

@ -22,8 +22,7 @@
?> ?>
<div class="entry-meta"> <div class="entry-meta">
<?php <?php
_s_posted_on(); _s_posted_on_by();
_s_posted_by();
?> ?>
</div><!-- .entry-meta --> </div><!-- .entry-meta -->
<?php endif; ?> <?php endif; ?>