Merge pull request #813 from IanDelMar/patch-1
Add filters for posted on/by
This commit is contained in:
commit
4c778ed270
|
@ -26,15 +26,23 @@ if ( ! function_exists ( 'understrap_posted_on' ) ) {
|
||||||
esc_attr( get_the_modified_date( 'c' ) ),
|
esc_attr( get_the_modified_date( 'c' ) ),
|
||||||
esc_html( get_the_modified_date() )
|
esc_html( get_the_modified_date() )
|
||||||
);
|
);
|
||||||
$posted_on = sprintf(
|
$posted_on = apply_filters(
|
||||||
esc_html_x( 'Posted on %s', 'post date', 'understrap' ),
|
'understrap_posted_on', sprintf(
|
||||||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
'<span class="posted-on">%1$s <a href="%2$s" rel="bookmark">%3$s</a></span>',
|
||||||
|
esc_html_x( 'Posted on', 'post date', 'understrap' ),
|
||||||
|
esc_url( get_permalink() ),
|
||||||
|
apply_filters( 'understrap_posted_on_time', $time_string )
|
||||||
|
)
|
||||||
);
|
);
|
||||||
$byline = sprintf(
|
$byline = apply_filters(
|
||||||
esc_html_x( 'by %s', 'post author', 'understrap' ),
|
'understrap_posted_by', sprintf(
|
||||||
'<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>'
|
'<span class="byline"> %1$s<span class="author vcard"><a class="url fn n" href="%2$s"> %3$s</a></span></span>',
|
||||||
|
$posted_on ? esc_html_x( 'by', 'post author', 'understrap' ) : esc_html_x( 'Posted by', 'post author', 'understrap' ),
|
||||||
|
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
|
||||||
|
esc_html( get_the_author() )
|
||||||
|
)
|
||||||
);
|
);
|
||||||
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
|
echo $posted_on . $byline; // WPCS: XSS OK.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,12 +57,14 @@ if ( ! function_exists ( 'understrap_entry_footer' ) ) {
|
||||||
/* translators: used between list items, there is a space after the comma */
|
/* translators: used between list items, there is a space after the comma */
|
||||||
$categories_list = get_the_category_list( esc_html__( ', ', 'understrap' ) );
|
$categories_list = get_the_category_list( esc_html__( ', ', 'understrap' ) );
|
||||||
if ( $categories_list && understrap_categorized_blog() ) {
|
if ( $categories_list && understrap_categorized_blog() ) {
|
||||||
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'understrap' ) . '</span>', $categories_list ); // WPCS: XSS OK.
|
/* translators: %s: Categories of current post */
|
||||||
|
printf( '<span class="cat-links">' . esc_html__( 'Posted in %s', 'understrap' ) . '</span>', $categories_list ); // WPCS: XSS OK.
|
||||||
}
|
}
|
||||||
/* translators: used between list items, there is a space after the comma */
|
/* translators: used between list items, there is a space after the comma */
|
||||||
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'understrap' ) );
|
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'understrap' ) );
|
||||||
if ( $tags_list ) {
|
if ( $tags_list ) {
|
||||||
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'understrap' ) . '</span>', $tags_list ); // WPCS: XSS OK.
|
/* translators: %s: Tags of current post */
|
||||||
|
printf( '<span class="tags-links">' . esc_html__( 'Tagged %s', 'understrap' ) . '</span>', $tags_list ); // WPCS: XSS OK.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
||||||
|
|
Reference in New Issue