From ba1258f3654d4441833ae3fb293fb332f2e71b68 Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Mon, 30 Jun 2014 16:43:07 +0100 Subject: [PATCH 1/4] _s: Simplify entry meta output - Fix entry-footer inconsistency between content-*.php files - Move in a function _s_entry_meta() to avoid duplication --- At the moment there is an inconsistency between content.php and content-single.php regarding the .entry-footer output. In my opinion content.php output is would be better to use because it's easier to translate and allow more customisation. Finally by moving it into inc/template-tags.php we are getting rid of some duplicated code. --- content-page.php | 3 ++- content-search.php | 30 ++---------------------------- content-single.php | 35 +---------------------------------- content.php | 30 ++---------------------------- inc/template-tags.php | 30 ++++++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 91 deletions(-) diff --git a/content-page.php b/content-page.php index 119896b8..fde16f7e 100644 --- a/content-page.php +++ b/content-page.php @@ -20,7 +20,8 @@ ) ); ?> + diff --git a/content-search.php b/content-search.php index c565c04f..f1426040 100644 --- a/content-search.php +++ b/content-search.php @@ -24,32 +24,6 @@ - \ No newline at end of file + diff --git a/content-single.php b/content-single.php index 252e7941..20c5d7df 100644 --- a/content-single.php +++ b/content-single.php @@ -24,39 +24,6 @@ diff --git a/content.php b/content.php index 869afce0..200bcc6a 100644 --- a/content.php +++ b/content.php @@ -26,32 +26,6 @@ - \ No newline at end of file + diff --git a/inc/template-tags.php b/inc/template-tags.php index 41907712..57023a5d 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -133,3 +133,33 @@ function _s_category_transient_flusher() { } add_action( 'edit_category', '_s_category_transient_flusher' ); add_action( 'save_post', '_s_category_transient_flusher' ); + +if ( ! function_exists( '_s_entry_meta' ) ) : +/** + * Prints HTML with meta information for the categories, tags, comments and edit link. + */ +function _s_entry_meta() { + /* Hide category and tag text for pages */ + if ( 'post' == get_post_type() ) { + /* translators: used between list items, there is a space after the comma */ + $categories_list = get_the_category_list( __( ', ', '_s' ) ); + if ( $categories_list && _s_categorized_blog() ) { + printf( '' . __( 'Posted in %1$s', '_s' ) . '', $categories_list ); + } + + /* translators: used between list items, there is a space after the comma */ + $tags_list = get_the_tag_list( '', __( ', ', '_s' ) ); + if ( $tags_list ) { + printf( '' . __( 'Tagged %1$s', '_s' ) . '', $tags_list ); + } + } + + if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) { + echo ''; + comments_popup_link( __( 'Leave a comment', '_s' ), __( '1 Comment', '_s' ), __( '% Comments', '_s' ) ); + echo ''; + } + + edit_post_link( __( 'Edit', '_s' ), '', '' ); +} +endif; From 2990f8260c111123fdcaa2dfb31178e10ed497ef Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Thu, 4 Sep 2014 13:28:24 +0200 Subject: [PATCH 2/4] _s: Update to entry meta output. See #537 * Rename function * Move edit link outside of function * Remove comments link on single post --- content-page.php | 2 +- content-search.php | 3 ++- content-single.php | 3 ++- content.php | 3 ++- inc/template-tags.php | 10 ++++------ 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/content-page.php b/content-page.php index fde16f7e..b0cc3458 100644 --- a/content-page.php +++ b/content-page.php @@ -22,6 +22,6 @@
- + ', '' ); ?>
diff --git a/content-search.php b/content-search.php index f1426040..9786ba35 100644 --- a/content-search.php +++ b/content-search.php @@ -24,6 +24,7 @@
- + + ', '' ); ?>
diff --git a/content-single.php b/content-single.php index 20c5d7df..130db9a5 100644 --- a/content-single.php +++ b/content-single.php @@ -24,6 +24,7 @@
- + + ', '' ); ?>
diff --git a/content.php b/content.php index 200bcc6a..9efa5cb8 100644 --- a/content.php +++ b/content.php @@ -26,6 +26,7 @@
- + + ', '' ); ?>
diff --git a/inc/template-tags.php b/inc/template-tags.php index 57023a5d..7a846af1 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -134,11 +134,11 @@ function _s_category_transient_flusher() { add_action( 'edit_category', '_s_category_transient_flusher' ); add_action( 'save_post', '_s_category_transient_flusher' ); -if ( ! function_exists( '_s_entry_meta' ) ) : +if ( ! function_exists( '_s_entry_footer' ) ) : /** - * Prints HTML with meta information for the categories, tags, comments and edit link. + * Prints HTML with meta information for the categories, tags and comments. */ -function _s_entry_meta() { +function _s_entry_footer() { /* Hide category and tag text for pages */ if ( 'post' == get_post_type() ) { /* translators: used between list items, there is a space after the comma */ @@ -154,12 +154,10 @@ function _s_entry_meta() { } } - if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) { + if ( ! is_single() && ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) { echo ''; comments_popup_link( __( 'Leave a comment', '_s' ), __( '1 Comment', '_s' ), __( '% Comments', '_s' ) ); echo ''; } - - edit_post_link( __( 'Edit', '_s' ), '', '' ); } endif; From a14b802e750e210257a64b7adc3ee98b1f5e6efc Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Wed, 10 Sep 2014 17:41:19 -0700 Subject: [PATCH 3/4] _s: Move edit link in template tag for consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every time `_s_entry_footer()` is used, it’s followed by `edit_post_link()`. Might as well just move that back in the template tag. --- content-search.php | 1 - content-single.php | 1 - content.php | 1 - inc/template-tags.php | 58 ++++++++++++++++++++++--------------------- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/content-search.php b/content-search.php index 9786ba35..a045902b 100644 --- a/content-search.php +++ b/content-search.php @@ -25,6 +25,5 @@
- ', '' ); ?>
diff --git a/content-single.php b/content-single.php index 130db9a5..0e13374e 100644 --- a/content-single.php +++ b/content-single.php @@ -25,6 +25,5 @@
- ', '' ); ?>
diff --git a/content.php b/content.php index 9efa5cb8..dd14136a 100644 --- a/content.php +++ b/content.php @@ -27,6 +27,5 @@
- ', '' ); ?>
diff --git a/inc/template-tags.php b/inc/template-tags.php index 7a846af1..7dd638d8 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -93,6 +93,36 @@ function _s_posted_on() { } endif; +if ( ! function_exists( '_s_entry_footer' ) ) : +/** + * Prints HTML with meta information for the categories, tags and comments. + */ +function _s_entry_footer() { + // Hide category and tag text for pages. + if ( 'post' == get_post_type() ) { + /* translators: used between list items, there is a space after the comma */ + $categories_list = get_the_category_list( __( ', ', '_s' ) ); + if ( $categories_list && _s_categorized_blog() ) { + printf( '' . __( 'Posted in %1$s', '_s' ) . '', $categories_list ); + } + + /* translators: used between list items, there is a space after the comma */ + $tags_list = get_the_tag_list( '', __( ', ', '_s' ) ); + if ( $tags_list ) { + printf( '' . __( 'Tagged %1$s', '_s' ) . '', $tags_list ); + } + } + + if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { + echo ''; + comments_popup_link( __( 'Leave a comment', '_s' ), __( '1 Comment', '_s' ), __( '% Comments', '_s' ) ); + echo ''; + } + + edit_post_link( __( 'Edit', '_s' ), '', '' ); +} +endif; + /** * Returns true if a blog has more than 1 category. * @@ -133,31 +163,3 @@ function _s_category_transient_flusher() { } add_action( 'edit_category', '_s_category_transient_flusher' ); add_action( 'save_post', '_s_category_transient_flusher' ); - -if ( ! function_exists( '_s_entry_footer' ) ) : -/** - * Prints HTML with meta information for the categories, tags and comments. - */ -function _s_entry_footer() { - /* Hide category and tag text for pages */ - if ( 'post' == get_post_type() ) { - /* translators: used between list items, there is a space after the comma */ - $categories_list = get_the_category_list( __( ', ', '_s' ) ); - if ( $categories_list && _s_categorized_blog() ) { - printf( '' . __( 'Posted in %1$s', '_s' ) . '', $categories_list ); - } - - /* translators: used between list items, there is a space after the comma */ - $tags_list = get_the_tag_list( '', __( ', ', '_s' ) ); - if ( $tags_list ) { - printf( '' . __( 'Tagged %1$s', '_s' ) . '', $tags_list ); - } - } - - if ( ! is_single() && ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) { - echo ''; - comments_popup_link( __( 'Leave a comment', '_s' ), __( '1 Comment', '_s' ), __( '% Comments', '_s' ) ); - echo ''; - } -} -endif; From 7a9b1656f64f8b5ec01f0760becae99ccfff31bf Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Wed, 10 Sep 2014 17:50:08 -0700 Subject: [PATCH 4/4] _s: Update pot file to reflect changes. --- languages/_s.pot | 114 ++++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 75 deletions(-) diff --git a/languages/_s.pot b/languages/_s.pot index 2bb2e64d..97b40e97 100644 --- a/languages/_s.pot +++ b/languages/_s.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: _s 1.0-wpcom\n" "Report-Msgid-Bugs-To: http://wordpress.org/tags/_s\n" -"POT-Creation-Date: 2014-06-03 14:02:16+00:00\n" +"POT-Creation-Date: 2014-09-11 00:43:48+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -17,9 +17,7 @@ msgid "Oops! That page can’t be found." msgstr "" #: 404.php:19 -msgid "" -"It looks like nothing was found at this location. Maybe try one of the links " -"below or a search?" +msgid "It looks like nothing was found at this location. Maybe try one of the links below or a search?" msgstr "" #: 404.php:27 @@ -27,6 +25,7 @@ msgid "Most Used Categories" msgstr "" #. translators: %1$s: smiley + #: 404.php:44 msgid "Try looking in the monthly archives. %1$s" msgstr "" @@ -93,7 +92,7 @@ msgstr "" msgid "Chats" msgstr "" -#: archive.php:66 sidebar.php:16 +#: archive.php:66 msgid "Archives" msgstr "" @@ -125,81 +124,29 @@ msgid "Nothing Found" msgstr "" #: content-none.php:19 -msgid "" -"Ready to publish your first post? Get started here." +msgid "Ready to publish your first post? Get started here." msgstr "" #: content-none.php:23 -msgid "" -"Sorry, but nothing matched your search terms. Please try again with some " -"different keywords." +msgid "Sorry, but nothing matched your search terms. Please try again with some different keywords." msgstr "" #: content-none.php:28 -msgid "" -"It seems we can’t find what you’re looking for. Perhaps " -"searching can help." +msgid "It seems we can’t find what you’re looking for. Perhaps searching can help." msgstr "" -#: content-page.php:18 content-single.php:20 content.php:27 +#: content-page.php:18 content-single.php:20 content.php:22 msgid "Pages:" msgstr "" -#: content-page.php:24 content-single.php:60 content.php:61 +#: content-page.php:25 inc/template-tags.php:122 msgid "Edit" msgstr "" -#. translators: used between list items, there is a space after the comma -#: content-single.php:29 content-single.php:32 content.php:38 content.php:48 -msgid ", " -msgstr "" - -#: content-single.php:37 -msgid "" -"This entry was tagged %2$s. Bookmark the permalink." -msgstr "" - -#: content-single.php:39 -msgid "Bookmark the permalink." -msgstr "" - -#: content-single.php:45 -msgid "" -"This entry was posted in %1$s and tagged %2$s. Bookmark the permalink." -msgstr "" - -#: content-single.php:47 -msgid "" -"This entry was posted in %1$s. Bookmark the permalink." -msgstr "" - -#: content.php:24 +#: content.php:19 msgid "Continue reading " msgstr "" -#: content.php:42 -msgid "Posted in %1$s" -msgstr "" - -#: content.php:52 -msgid "Tagged %1$s" -msgstr "" - -#: content.php:58 -msgid "Leave a comment" -msgstr "" - -#: content.php:58 -msgid "1 Comment" -msgstr "" - -#: content.php:58 -msgid "% Comments" -msgstr "" - #: footer.php:15 msgid "http://wordpress.org/" msgstr "" @@ -246,12 +193,12 @@ msgstr "" #: inc/template-tags.php:55 msgctxt "Previous post link" -msgid " %title" +msgid " %title" msgstr "" #: inc/template-tags.php:56 msgctxt "Next post link" -msgid "%title " +msgid "%title " msgstr "" #: inc/template-tags.php:82 @@ -264,14 +211,35 @@ msgctxt "post author" msgid "by %s" msgstr "" +#. translators: used between list items, there is a space after the comma + +#: inc/template-tags.php:104 inc/template-tags.php:110 +msgid ", " +msgstr "" + +#: inc/template-tags.php:106 +msgid "Posted in %1$s" +msgstr "" + +#: inc/template-tags.php:112 +msgid "Tagged %1$s" +msgstr "" + +#: inc/template-tags.php:118 +msgid "Leave a comment" +msgstr "" + +#: inc/template-tags.php:118 +msgid "1 Comment" +msgstr "" + +#: inc/template-tags.php:118 +msgid "% Comments" +msgstr "" + #: search.php:16 msgid "Search Results for: %s" msgstr "" - -#: sidebar.php:23 -msgid "Meta" -msgstr "" - #. Theme Name of the plugin/theme msgid "_s" msgstr "" @@ -281,11 +249,7 @@ msgid "http://underscores.me/" msgstr "" #. Description of the plugin/theme -msgid "" -"Hi. I'm a starter theme called _s, or underscores, if " -"you like. I'm a theme meant for hacking so don't use me as a Parent " -"Theme. Instead try turning me into the next, most awesome, WordPress " -"theme out there. That's what I'm here for." +msgid "Hi. I'm a starter theme called _s, or underscores, if you like. I'm a theme meant for hacking so don't use me as a Parent Theme. Instead try turning me into the next, most awesome, WordPress theme out there. That's what I'm here for." msgstr "" #. Author of the plugin/theme