From f2881285b7510926752aec353bb3fa419f2baa84 Mon Sep 17 00:00:00 2001 From: Thomas Guillot Date: Fri, 27 Jun 2014 12:57:31 +0100 Subject: [PATCH] _s: Simplify entry meta output - Add entry-footer consistency between content-*.php files - Move in a function _s_entry_meta() to avoid duplicate --- 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 0ff39e25..bbf68a20 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; \ No newline at end of file