%2$s';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( DATE_W3C ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( DATE_W3C ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
/* translators: %s: post date. */
'' . $time_string . ''
);
echo '' . $posted_on . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;
if ( ! function_exists( 'blog_point_author_gravator' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function blog_point_author_gravator() {
echo get_avatar(
get_the_author_meta( 'ID' ),
100,
'',
'',
array(
'class' => 'author-avatar'
)
);
}
endif;
if ( ! function_exists( 'blog_point_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function blog_point_posted_by() {
if ( get_theme_mod( 'blog_point_enable_author', true ) === false ) {
return;
}
$byline = sprintf(
/* translators: %s: post author. */
'%s %s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html__( 'by', 'blog-point' ),
esc_html( get_the_author() )
);
echo '' . wp_kses_post( $byline ) . ''; // Ensuring safe output
}
endif;
if ( ! function_exists( 'blog_point_categories_list' ) ) :
/**
* Prints HTML with meta information for the categories.
*/
function blog_point_categories_list() {
if ( get_theme_mod( 'blog_point_enable_category', true ) === false ) {
return;
}
if ( 'post' === get_post_type() ) {
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '
';
foreach ( $categories as $category ) {
// Fetch category color from term meta.
$color = get_term_meta( $category->term_id, 'blog_point_custom_category_hue', true );
if ( ! $color ) {
$color = 'var(--theme-primary-hue)'; // fallback if no color is set.
}
printf(
'%3$s',
esc_url( get_category_link( $category->term_id ) ),
esc_attr( $color ),
esc_html( $category->name ),
esc_attr( $category->slug )
);
}
echo ' ';
}
}
}
endif;
if ( ! function_exists( 'blog_point_get_reading_time' ) ) :
function blog_point_get_reading_time( $post_id = null ) {
if ( ! $post_id ) {
$post_id = get_the_ID();
}
$content = get_post_field( 'post_content', $post_id );
// Remove shortcodes & HTML.
$content = strip_shortcodes( $content );
$content = wp_strip_all_tags( $content );
$word_count = str_word_count( $content );
$words_per_minute = 200; // You can change this.
$minutes = ceil( $word_count / $words_per_minute );
if ( $minutes < 1 ) {
$minutes = 1;
}
$label = sprintf(
_n( '%d min read', '%d mins read', $minutes, 'blog-point' ),
$minutes
);
return '' . esc_html( $label ) . '';
}
endif;
if ( ! function_exists( 'blog_point_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function blog_point_entry_footer() {
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'blog-point' ) );
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf( '' . esc_html__( 'Tagged %1$s', 'blog-point' ) . '', $tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit %s', 'blog-point' ),
array(
'span' => array(
'class' => array(),
),
)
),
wp_kses_post( get_the_title() )
),
'',
''
);
}
endif;
if ( ! function_exists( 'blog_point_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*/
function blog_point_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
the_title_attribute(
array(
'echo' => false,
)
),
)
);
?>