forked from mirror/_s
replace _s_posted_on and _s_posted_by with _s_posted_on_by for better i18n
This commit is contained in:
parent
f5f3a0a05b
commit
43bc383c26
|
@ -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' ),
|
esc_html_x( '<span class="posted-on">Posted on %1$s</span> <span class="byline">by %2%s</span>', 'post author', '_s' ),
|
||||||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>',
|
||||||
);
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -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; ?>
|
||||||
|
|
|
@ -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; ?>
|
||||||
|
|
Reference in New Issue