forked from mirror/_s
Split _s_posted_on into two functions
This commit is contained in:
parent
ff6cc41087
commit
2d74ebd7c9
|
@ -9,7 +9,7 @@
|
|||
|
||||
if ( ! function_exists( '_s_posted_on' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the current post-date/time and author.
|
||||
* Prints HTML with meta information for the current post-date/time.
|
||||
*/
|
||||
function _s_posted_on() {
|
||||
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
||||
|
@ -30,13 +30,23 @@ if ( ! function_exists( '_s_posted_on' ) ) :
|
|||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
||||
);
|
||||
|
||||
echo '<span class="posted-on">' . $posted_on . '</span>'; // WPCS: XSS OK.
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( '_s_posted_by' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the current author.
|
||||
*/
|
||||
function _s_posted_by() {
|
||||
$byline = sprintf(
|
||||
/* translators: %s: post author. */
|
||||
esc_html_x( 'by %s', 'post author', '_s' ),
|
||||
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
||||
);
|
||||
|
||||
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
|
||||
echo '<span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
|
||||
|
||||
}
|
||||
endif;
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
|
||||
<?php if ( 'post' === get_post_type() ) : ?>
|
||||
<div class="entry-meta">
|
||||
<?php _s_posted_on(); ?>
|
||||
<?php
|
||||
_s_posted_on();
|
||||
_s_posted_by();
|
||||
?>
|
||||
</div><!-- .entry-meta -->
|
||||
<?php endif; ?>
|
||||
</header><!-- .entry-header -->
|
||||
|
|
|
@ -20,7 +20,10 @@
|
|||
|
||||
if ( 'post' === get_post_type() ) : ?>
|
||||
<div class="entry-meta">
|
||||
<?php _s_posted_on(); ?>
|
||||
<?php
|
||||
_s_posted_on();
|
||||
_s_posted_by();
|
||||
?>
|
||||
</div><!-- .entry-meta -->
|
||||
<?php
|
||||
endif; ?>
|
||||
|
|
Reference in New Issue