'%s', 'tag' => $is_single ? 'h1' : 'h1', 'link' => ! $is_single, 'class' => 'entry-title', 'before' => '', 'after' => '' ] ); $text = sprintf( $args['text'], $is_single ? single_post_title( '', false ) : the_title( '', '', false ) ); if ( $args['link'] ) { $text = render_permalink( [ 'text' => $text ] ); } $html = sprintf( '<%1$s class="%2$s">%3$s%1$s>', tag_escape( $args['tag'] ), esc_attr( $args['class'] ), $text ); return apply_filters( 'backdrop_display_title', $args['before'] . $html . $args['after'] ); } /** * Outputs the post permalink HTML. * * @since 1.0.0 * @access public * @param array $args * @return void */ function display_permalink( array $args = [] ) { echo render_permalink( $args ); // phpcs:ignore } /** * Returns the post permalink HTML. * * @since 1.0.0 * @access public * @param array $args * @return string */ function render_permalink( array $args = [] ) { $args = wp_parse_args( $args, [ 'text' => '%s', 'class' => 'entry-permalink', 'before' => '', 'after' => '' ] ); $url = get_permalink(); $html = sprintf( '%s', esc_attr( $args['class'] ), esc_url( $url ), sprintf( $args['text'], esc_url( $url ) ) ); return apply_filters( 'backdrop_display_permalink', $args['before'] . $html . $args['after'] ); } /** * Outputs the post author HTML. * * @since 1.0.0 * @access public * @param array $args * @return void */ function display_author( array $args = [] ) { echo render_author( $args ); // phpcs:ignore } function render_author( array $args = [] ) { $args = wp_parse_args( $args, [ 'text' => '%s', 'class' => 'entry-author', 'link' => true, 'before' => '', 'after' => '' ] ); $author = get_the_author(); if ( $args['link'] ) { $url = get_author_posts_url( get_the_author_meta( 'ID' ) ); $author = sprintf( '%s', esc_url( $url ), $author ); } $html = sprintf( '%s', esc_attr( $args['class'] ), $author ); return apply_filters( 'backdrop_display_author', $args['before'] . $html . $args['after'] ); } /** * Outputs the post date HTML. * * @since 1.0.0 * @access public * @param array $args * @return void */ function display_date( array $args = [] ) { echo render_date( $args ); // phpcs:ignore } /** * Returns the post date HTML. * * @since 1.0.0 * @access public * @param array $args * @return string */ function render_date( array $args = [] ) { $args = wp_parse_args( $args, [ 'text' => '%s', 'class' => 'entry-published', 'format' => '', 'before' => '', 'after' => '' ] ); $html = sprintf( '', esc_attr( $args['class'] ), esc_attr( get_the_date( DATE_W3C ) ), sprintf( $args['text'], get_the_date( $args['format'] ) ) ); return apply_filters( 'backdrop_display_date', $args['before'] . $html . $args['after'] ); } /** * Outputs the post comments link HTML. * * @since 1.0.0 * @access public * @param array $args * @return void */ function display_comments_link( array $args = [] ) { echo render_comments_link( $args ); // phpcs:ignore } /** * Returns the post comments link HTML. * * @since 1.0.0 * @access public * @param array $args * @return string */ function render_comments_link( array $args = [] ) { $args = wp_parse_args( $args, [ 'zero' => false, 'one' => false, 'more' => false, 'class' => 'entry-comments', 'before' => '', 'after' => '' ] ); $number = get_comments_number(); if ( 0 == $number && ! comments_open() && ! pings_open() ) { return ''; } $url = get_comments_link(); $text = get_comments_number_text( $args['zero'], $args['one'], $args['more'] ); $html = sprintf( '%s', esc_attr( $args['class'] ), esc_url( $url ), $text ); return apply_filters( 'backdrop_display_comments_link', $args['before'] . $html . $args['after'] ); } function display_categories( array $args = [] ) { echo render_categories( $args ); // phpcs:ignore } /** * Returns the post terms HTML. * * @since 1.0.0 * @access public * @param array $args * @return string */ function render_categories( array $args = [] ) { $html = ''; $args = wp_parse_args( $args, [ 'taxonomy' => 'category', 'text' => '%s', 'class' => 'cat-list', 'sep' => _x( ' | ', 'taxonomy terms separator', 'backdrop-core' ), 'before' => '