%2$s';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$posted_on = $time_string;
$byline = sprintf( esc_html_x( 'by %s', 'post author', 'mardi-gras' ), '' . esc_html( get_the_author() ) . '' );
echo $posted_on . ' ' . $byline; // WPCS: XSS OK.
}
}
if ( ! function_exists( 'mardi_gras_entry_footer' ) ) {
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function mardi_gras_entry_footer() {
// Hide category and tag text for pages and events.
// Events already show categories in the content.
if ( 'post' === get_post_type() ) {
$categories_list = get_the_category_list( '·' );
if ( $categories_list ) {
echo '' . esc_html__( 'Categories: ', 'mardi-gras' ) . $categories_list . ''; // WPCS: XSS OK.
}
$tags_list = get_the_tag_list( '', '·' );
if ( $tags_list ) {
echo '' . esc_html__( 'Tags: ', 'mardi-gras' ) . $tags_list . ''; // WPCS: XSS OK.
}
}
}
}
if ( ! function_exists( 'mardi_gras_post_title' ) ) {
/**
* Add a title to posts that are missing titles.
*/
function mardi_gras_post_title( $title ) {
if ( '' == $title ) {
return esc_html__( '(Untitled)', 'mardi-gras' );
} else {
return $title;
}
}
add_filter( 'the_title', 'mardi_gras_post_title' );
}
if ( ! function_exists( 'mardi_gras_comments_pagination' ) ) {
/**
* Because get_the_comments_pagination() only accepts one type (plain) I had to alter the function slightly to add the list type,
* so that the comment pagination could be styled in the same way as the post pagination.
* https://developer.wordpress.org/reference/functions/get_the_comments_pagination/
* Related ticket: https://core.trac.wordpress.org/ticket/39792
**/
function mardi_gras_comments_pagination( $args = array() ) {
$navigation = '';
$args = wp_parse_args(
$args,
array(
'screen_reader_text' => __( 'Comments navigation', 'mardi-gras' ),
'prev_text' => _x( 'Previous', 'previous set of comments', 'mardi-gras' ),
'next_text' => _x( 'Next', 'next set of comments', 'mardi-gras' ),
'type' => 'list',
)
);
$links = paginate_comments_links( $args );
if ( $links ) {
$navigation = _navigation_markup( $links, 'comments-pagination', $args['screen_reader_text'] );
}
}
}