From 43bc383c26db8a696dcb98bed1adc38709d915ed Mon Sep 17 00:00:00 2001 From: Yoav Farhi Date: Sun, 8 Apr 2018 11:07:55 +0300 Subject: [PATCH] replace _s_posted_on and _s_posted_by with _s_posted_on_by for better i18n --- inc/template-tags.php | 33 ++++++++----------------------- template-parts/content-search.php | 3 +-- template-parts/content.php | 3 +-- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/inc/template-tags.php b/inc/template-tags.php index 769c6ac1..bb72c12c 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -7,11 +7,12 @@ * @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 = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; @@ -24,30 +25,12 @@ if ( ! function_exists( '_s_posted_on' ) ) : esc_html( get_the_modified_date() ) ); - $posted_on = sprintf( - /* translators: %s: post date. */ - esc_html_x( 'Posted on %s', 'post date', '_s' ), - '' . $time_string . '' - ); - - echo '' . $posted_on . ''; // 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' ), + printf( + /* translators: %1$s: post date, %2$s: post author . */ + esc_html_x( 'Posted on %1$s by %2%s', 'post author', '_s' ), + '' . $time_string . '', '' . esc_html( get_the_author() ) . '' ); - - echo ' ' . $byline . ''; // WPCS: XSS OK. - } endif; diff --git a/template-parts/content-search.php b/template-parts/content-search.php index b25dadf2..e4ac41c4 100644 --- a/template-parts/content-search.php +++ b/template-parts/content-search.php @@ -16,8 +16,7 @@
diff --git a/template-parts/content.php b/template-parts/content.php index 0573e82e..3cbf5b09 100644 --- a/template-parts/content.php +++ b/template-parts/content.php @@ -22,8 +22,7 @@ ?>