From 43bc383c26db8a696dcb98bed1adc38709d915ed Mon Sep 17 00:00:00 2001 From: Yoav Farhi Date: Sun, 8 Apr 2018 11:07:55 +0300 Subject: [PATCH 1/3] 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 769c6ac10e..bb72c12ce5 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 @@ function _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 b25dadf243..e4ac41c45b 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 0573e82e53..3cbf5b0915 100644 --- a/template-parts/content.php +++ b/template-parts/content.php @@ -22,8 +22,7 @@ ?>
From 6af98e3e3b5b0180e72da3674e2caf9f180071ca Mon Sep 17 00:00:00 2001 From: Yoav Farhi Date: Sun, 8 Apr 2018 11:11:14 +0300 Subject: [PATCH 2/3] remove context --- inc/template-tags.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/template-tags.php b/inc/template-tags.php index bb72c12ce5..f44c33b63c 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -27,7 +27,7 @@ function _s_posted_on_by() { printf( /* translators: %1$s: post date, %2$s: post author . */ - esc_html_x( 'Posted on %1$s ', 'post author', '_s' ), + __( 'Posted on %1$s ', '_s' ), '' . $time_string . '', '' . esc_html( get_the_author() ) . '' ); From b2880f537eaae85086cd0313733683b658b744a5 Mon Sep 17 00:00:00 2001 From: Yoav Farhi Date: Sun, 8 Apr 2018 11:17:40 +0300 Subject: [PATCH 3/3] some CS --- inc/template-tags.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/template-tags.php b/inc/template-tags.php index f44c33b63c..8044c30339 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -26,9 +26,9 @@ function _s_posted_on_by() { ); printf( - /* translators: %1$s: post date, %2$s: post author . */ - __( 'Posted on %1$s ', '_s' ), - '' . $time_string . '', + /* translators: %1$s: post date, %2$s: post author . */ + __( 'Posted on %1$s ', '_s' ), + '' . $time_string . '', // WPCS: XSS OK. '' . esc_html( get_the_author() ) . '' ); }