forked from mirror/_s
Merge pull request #532 from Automattic/Entry-Meta-Consistency
Make entry meta more consistent throughout _s and gut out code duplication.
This commit is contained in:
commit
2271e29802
|
@ -20,7 +20,8 @@
|
|||
) );
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<?php edit_post_link( __( 'Edit', '_s' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
<?php _s_entry_meta(); ?>
|
||||
</footer><!-- .entry-footer -->
|
||||
</article><!-- #post-## -->
|
||||
|
|
|
@ -24,32 +24,6 @@
|
|||
</div><!-- .entry-summary -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
|
||||
<?php
|
||||
/* 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() ) :
|
||||
?>
|
||||
<span class="cat-links">
|
||||
<?php printf( __( 'Posted in %1$s', '_s' ), $categories_list ); ?>
|
||||
</span>
|
||||
<?php endif; // End if categories ?>
|
||||
|
||||
<?php
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
$tags_list = get_the_tag_list( '', __( ', ', '_s' ) );
|
||||
if ( $tags_list ) :
|
||||
?>
|
||||
<span class="tags-links">
|
||||
<?php printf( __( 'Tagged %1$s', '_s' ), $tags_list ); ?>
|
||||
</span>
|
||||
<?php endif; // End if $tags_list ?>
|
||||
<?php endif; // End if 'post' == get_post_type() ?>
|
||||
|
||||
<?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
|
||||
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', '_s' ), __( '1 Comment', '_s' ), __( '% Comments', '_s' ) ); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php edit_post_link( __( 'Edit', '_s' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
<?php _s_entry_meta(); ?>
|
||||
</footer><!-- .entry-footer -->
|
||||
</article><!-- #post-## -->
|
||||
</article><!-- #post-## -->
|
||||
|
|
|
@ -24,39 +24,6 @@
|
|||
</div><!-- .entry-content -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<?php
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
$category_list = get_the_category_list( __( ', ', '_s' ) );
|
||||
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
$tag_list = get_the_tag_list( '', __( ', ', '_s' ) );
|
||||
|
||||
if ( ! _s_categorized_blog() ) {
|
||||
// This blog only has 1 category so we just need to worry about tags in the meta text
|
||||
if ( '' != $tag_list ) {
|
||||
$meta_text = __( 'This entry was tagged %2$s. Bookmark the <a href="%3$s" rel="bookmark">permalink</a>.', '_s' );
|
||||
} else {
|
||||
$meta_text = __( 'Bookmark the <a href="%3$s" rel="bookmark">permalink</a>.', '_s' );
|
||||
}
|
||||
|
||||
} else {
|
||||
// But this blog has loads of categories so we should probably display them here
|
||||
if ( '' != $tag_list ) {
|
||||
$meta_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" rel="bookmark">permalink</a>.', '_s' );
|
||||
} else {
|
||||
$meta_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" rel="bookmark">permalink</a>.', '_s' );
|
||||
}
|
||||
|
||||
} // end check for categories on this blog
|
||||
|
||||
printf(
|
||||
$meta_text,
|
||||
$category_list,
|
||||
$tag_list,
|
||||
get_permalink()
|
||||
);
|
||||
?>
|
||||
|
||||
<?php edit_post_link( __( 'Edit', '_s' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
<?php _s_entry_meta(); ?>
|
||||
</footer><!-- .entry-footer -->
|
||||
</article><!-- #post-## -->
|
||||
|
|
30
content.php
30
content.php
|
@ -26,32 +26,6 @@
|
|||
</div><!-- .entry-content -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
|
||||
<?php
|
||||
/* 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() ) :
|
||||
?>
|
||||
<span class="cat-links">
|
||||
<?php printf( __( 'Posted in %1$s', '_s' ), $categories_list ); ?>
|
||||
</span>
|
||||
<?php endif; // End if categories ?>
|
||||
|
||||
<?php
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
$tags_list = get_the_tag_list( '', __( ', ', '_s' ) );
|
||||
if ( $tags_list ) :
|
||||
?>
|
||||
<span class="tags-links">
|
||||
<?php printf( __( 'Tagged %1$s', '_s' ), $tags_list ); ?>
|
||||
</span>
|
||||
<?php endif; // End if $tags_list ?>
|
||||
<?php endif; // End if 'post' == get_post_type() ?>
|
||||
|
||||
<?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
|
||||
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', '_s' ), __( '1 Comment', '_s' ), __( '% Comments', '_s' ) ); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php edit_post_link( __( 'Edit', '_s' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
<?php _s_entry_meta(); ?>
|
||||
</footer><!-- .entry-footer -->
|
||||
</article><!-- #post-## -->
|
||||
</article><!-- #post-## -->
|
||||
|
|
|
@ -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( '<span class="cat-links">' . __( 'Posted in %1$s', '_s' ) . '</span>', $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( '<span class="tags-links">' . __( 'Tagged %1$s', '_s' ) . '</span>', $tags_list );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) {
|
||||
echo '<span class="comments-link">';
|
||||
comments_popup_link( __( 'Leave a comment', '_s' ), __( '1 Comment', '_s' ), __( '% Comments', '_s' ) );
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
edit_post_link( __( 'Edit', '_s' ), '<span class="edit-link">', '</span>' );
|
||||
}
|
||||
endif;
|
Reference in New Issue