From 9e6640193006f0af8ef6acca4f4ee0901b636bd2 Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Mon, 30 Jun 2014 16:36:34 +0100 Subject: [PATCH] _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;