%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( azure_news_get_the_date() ),
esc_attr( get_the_modified_date( DATE_W3C ) ),
esc_html( azure_news_get_the_modified_date() )
);
$posted_on = sprintf(
'' . $time_string . ''
);
$azure_news_posts_date_style = azure_news_get_customizer_option_value( 'azure_news_posts_date_style' );
if ( 'modify' === $azure_news_posts_date_style ) {
$date_schema = azure_news_get_schema_markup( 'modified_date' );
} else {
$date_schema = azure_news_get_schema_markup( 'publish_date' );
}
echo '' . $posted_on . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;
if ( ! function_exists( 'azure_news_get_the_date' ) ) :
/**
* get the post published date according to the theme option
*
* @since 1.0.0
*/
function azure_news_get_the_date() {
$azure_news_posts_date_format = azure_news_get_customizer_option_value( 'azure_news_posts_date_format' );
if ( 'format_one' === $azure_news_posts_date_format ) {
$post_date = human_time_diff( get_the_time('U'), current_time('timestamp') ).' '.__( 'ago', 'azure-news' );
} else {
$post_date = get_the_date();
}
return apply_filters( 'azure_news_get_the_date_format_published_date', $post_date );
}
endif;
if ( ! function_exists( 'azure_news_get_the_modified_date' ) ) :
/**
* get the post modified date according to the theme option
*
* @since 1.0.0
*/
function azure_news_get_the_modified_date() {
$azure_news_posts_date_format = azure_news_get_customizer_option_value( 'azure_news_posts_date_format' );
if ( 'format_one' === $azure_news_posts_date_format ) {
$post_date = human_time_diff( get_the_modified_time('U'), current_time('timestamp') ).' '.__( 'ago', 'azure-news' );
} else {
$post_date = get_the_modified_date();
}
return apply_filters( 'azure_news_get_the_date_format_modified_date', $post_date );
}
endif;
if ( ! function_exists( 'azure_news_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function azure_news_posted_by() {
$byline = sprintf(
'' . esc_html( get_the_author() ) . ''
);
echo ' ' . $byline . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
endif;
if ( ! function_exists( 'azure_news_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function azure_news_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', 'azure-news' ) );
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf( '' . esc_html__( 'Tagged %1$s', 'azure-news' ) . '', $tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit %s', 'azure-news' ),
array(
'span' => array(
'class' => array(),
),
)
),
wp_kses_post( get_the_title() )
),
'',
''
);
}
endif;
if ( ! function_exists( 'azure_news_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 azure_news_post_thumbnail( $size = 'full' ) {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
$azure_news_posts_thumbnail_hover_effect = azure_news_get_customizer_option_value( 'azure_news_posts_thumbnail_hover_effect' );
echo '';
$image_attr = array();
$lazy_load = apply_filters( 'azure_news_post_thumbnail_lazy_load', true );
if ( false === $lazy_load ) {
$image_attr['loading'] = false;
}
$image_attr['alt'] = the_title_attribute( array( 'echo' => false ) );
if ( is_singular() ) :
?>
';
}
endif;
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Shim for sites older than 5.2.
*
* @link https://core.trac.wordpress.org/ticket/12563
*/
function wp_body_open() {
do_action( 'wp_body_open' );
}
endif;
if ( ! function_exists( 'azure_news_the_post_categories_list' ) ) :
/**
* function to display the lists of post categories
*
* @since 1.0.0
*/
function azure_news_the_post_categories_list( $post_id, $list_count ) {
$categories_list = wp_get_post_categories( $post_id, array( 'number' => absint( $list_count ) ) );
if ( empty( $categories_list ) ) {
return;
}
echo '';
foreach ( $categories_list as $category ) {
echo '- '. esc_html( get_cat_name( $category ) ) .'
';
}
echo '
';
}
endif;
if ( ! function_exists( 'azure_news_post_comment' ) ) :
/**
* Display comment count for homepage posts
*
* @since 1.0.0
*/
function azure_news_post_comment() {
echo '';
}
endif;
if ( ! function_exists( 'azure_news_the_estimated_reading_time' ) ) :
/**
* function to display the estimated reading time for post content.
*
* @since 1.0.0
*/
function azure_news_the_estimated_reading_time( $post_id = NULL ) {
$azure_news_posts_reading_time_enable = azure_news_get_customizer_option_value( 'azure_news_posts_reading_time_enable' );
if ( false === $azure_news_posts_reading_time_enable ) {
return;
}
$post_words_per_minute = apply_filters( 'azure_news_post_words_per_minute', 150 );
if ( empty( $post_id ) ) {
$post_id = get_the_ID();
}
$get_post_content = apply_filters( 'the_content', get_post_field( 'post_content', $post_id ) );
$content_decode = html_entity_decode( $get_post_content );
$do_shortcode_decode = do_shortcode( $content_decode );
$all_tags_strips = wp_strip_all_tags( $do_shortcode_decode );
$get_post_content_words = str_word_count( wp_strip_all_tags( do_shortcode( html_entity_decode( $get_post_content ) ) ) );
$read_per_minute = floor( $get_post_content_words / $post_words_per_minute );
if ( $read_per_minute < 1 || $read_per_minute == 1 ) {
$read_per_minute = 1;
$minute_label = __( 'min read', 'azure-news' );
} else {
$minute_label = __( 'mins read', 'azure-news' );
}
$output_string = sprintf( __( '%1$s %2$s', 'azure-news' ), $read_per_minute, $minute_label );
echo ''. esc_html( $output_string ) .'';
}
endif;