From 4366f4018a6c40646a82e6fcf5795599e2c06fa4 Mon Sep 17 00:00:00 2001 From: alaczek Date: Wed, 5 Jul 2017 17:15:07 +1000 Subject: [PATCH 1/5] Add "Next/Previous" text to single-post navigation in addition to post title. --- languages/_s.pot | 16 ++++++++++++++++ single.php | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/languages/_s.pot b/languages/_s.pot index ca726050..8cb5d0e0 100644 --- a/languages/_s.pot +++ b/languages/_s.pot @@ -116,6 +116,22 @@ msgstr "" msgid "Primary Menu" msgstr "" +#: single.php:21 +msgid "Previous Post" +msgstr "" + +#: single.php:21 +msgid "Previous" +msgstr "" + +#: single.php:22 +msgid "Next Post" +msgstr "" + +#: single.php:22 +msgid "Next" +msgstr "" + #. translators: %s: post date. #: inc/template-tags.php:29 #, php-format diff --git a/single.php b/single.php index 4f058f73..329400ac 100644 --- a/single.php +++ b/single.php @@ -17,7 +17,10 @@ get_header(); ?> get_template_part( 'template-parts/content', get_post_format() ); - the_post_navigation(); + the_post_navigation( array( + 'prev_text' => '' . __( 'Previous Post', '_s' ) . ' %title', + 'next_text' => '' . __( 'Next Post', '_s' ) . ' %title', + ) ); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) : From 3de72a1cbd985826213c2b4b448ca902f4224677 Mon Sep 17 00:00:00 2001 From: alaczek Date: Fri, 7 Jul 2017 10:26:45 +1000 Subject: [PATCH 2/5] Remove the word "Post", as it will not apply for Custom Post Types. --- languages/_s.pot | 8 -------- single.php | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/languages/_s.pot b/languages/_s.pot index 8cb5d0e0..a212a4a5 100644 --- a/languages/_s.pot +++ b/languages/_s.pot @@ -116,18 +116,10 @@ msgstr "" msgid "Primary Menu" msgstr "" -#: single.php:21 -msgid "Previous Post" -msgstr "" - #: single.php:21 msgid "Previous" msgstr "" -#: single.php:22 -msgid "Next Post" -msgstr "" - #: single.php:22 msgid "Next" msgstr "" diff --git a/single.php b/single.php index 329400ac..320d7a79 100644 --- a/single.php +++ b/single.php @@ -18,8 +18,8 @@ get_header(); ?> get_template_part( 'template-parts/content', get_post_format() ); the_post_navigation( array( - 'prev_text' => '' . __( 'Previous Post', '_s' ) . ' %title', - 'next_text' => '' . __( 'Next Post', '_s' ) . ' %title', + 'prev_text' => '' . __( 'Previous', '_s' ) . ' %title', + 'next_text' => '' . __( 'Next', '_s' ) . ' %title', ) ); // If comments are open or we have at least one comment, load up the comment template. From c05e3ab6ec9272236d15e6bcae14d8438b202cda Mon Sep 17 00:00:00 2001 From: alaczek Date: Mon, 28 Aug 2017 17:54:58 +1000 Subject: [PATCH 3/5] Remove the screen reader text for Previous/Next post navigation. Update .pot file. --- languages/_s.pot | 4 ++-- single.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/languages/_s.pot b/languages/_s.pot index a212a4a5..2d1f6daa 100644 --- a/languages/_s.pot +++ b/languages/_s.pot @@ -117,11 +117,11 @@ msgid "Primary Menu" msgstr "" #: single.php:21 -msgid "Previous" +msgid "Previous:" msgstr "" #: single.php:22 -msgid "Next" +msgid "Next:" msgstr "" #. translators: %s: post date. diff --git a/single.php b/single.php index 320d7a79..9bb3469b 100644 --- a/single.php +++ b/single.php @@ -18,8 +18,8 @@ get_header(); ?> get_template_part( 'template-parts/content', get_post_format() ); the_post_navigation( array( - 'prev_text' => '' . __( 'Previous', '_s' ) . ' %title', - 'next_text' => '' . __( 'Next', '_s' ) . ' %title', + 'prev_text' => '' . __( 'Previous:', '_s' ) . ' %title', + 'next_text' => '' . __( 'Next:', '_s' ) . ' %title', ) ); // If comments are open or we have at least one comment, load up the comment template. From 8878f1ad7d260d8e25af988e66c0b0f6366c8d98 Mon Sep 17 00:00:00 2001 From: alaczek Date: Tue, 29 May 2018 11:57:18 +1000 Subject: [PATCH 4/5] Removing duplicate entry in the translation file. Switching the translation function for single post navigation to esc_html__ --- languages/_s.pot | 8 -------- single.php | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/languages/_s.pot b/languages/_s.pot index 02d0f275..ef9fb8a0 100644 --- a/languages/_s.pot +++ b/languages/_s.pot @@ -83,14 +83,6 @@ msgstr "" msgid "Next:" msgstr "" -#. translators: %s: post date. -#: inc/template-tags.php:29 -#, php-format -#@ _s -msgctxt "post date" -msgid "Posted on %s" -msgstr "" - #: inc/template-tags.php:52 #. translators: used between list items, there is a space after the comma msgid ", " diff --git a/single.php b/single.php index 420fe8b1..d096016b 100644 --- a/single.php +++ b/single.php @@ -18,8 +18,8 @@ get_header(); ?> get_template_part( 'template-parts/content', get_post_type() ); the_post_navigation( array( - 'prev_text' => '' . __( 'Previous:', '_s' ) . ' %title', - 'next_text' => '' . __( 'Next:', '_s' ) . ' %title', + 'prev_text' => '' . esc_html__( 'Previous:', '_s' ) . ' %title', + 'next_text' => '' . esc_html__( 'Next:', '_s' ) . ' %title', ) ); // If comments are open or we have at least one comment, load up the comment template. From 40978b6b78701225c6f36e209c7421fa20ab50a3 Mon Sep 17 00:00:00 2001 From: Ismail El Korchi Date: Fri, 17 Apr 2020 22:24:27 +0100 Subject: [PATCH 5/5] Fix WPCS errors --- single.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/single.php b/single.php index 0abfd0f2..86319dc2 100644 --- a/single.php +++ b/single.php @@ -19,10 +19,12 @@ get_header(); get_template_part( 'template-parts/content', get_post_type() ); - the_post_navigation( array( - 'prev_text' => '' . esc_html__( 'Previous:', '_s' ) . ' %title', - 'next_text' => '' . esc_html__( 'Next:', '_s' ) . ' %title', - ) ); + the_post_navigation( + array( + 'prev_text' => '' . esc_html__( 'Previous:', '_s' ) . ' %title', + 'next_text' => '' . esc_html__( 'Next:', '_s' ) . ' %title', + ) + ); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) :