' . $read_time . $time_unit . $time_postfix . ''; } break; default: $output_str = apply_filters( 'bevro_meta_case_' . $meta_value, $output_str, $loop_count, $separator ); } $loop_count ++; } return $output_str; } } if ( ! function_exists( 'bevro_calculate_reading_time' ) ){ /** * Calculate reading time. * * @since 1.0 * * @param int $post_id Post content. * @return int read time. */ function bevro_calculate_reading_time( $post_id ){ $post_content = get_post_field( 'post_content', $post_id ); $stripped_content = strip_shortcodes( $post_content ); $strip_tags_content = strip_tags( $stripped_content ); $word_count = str_word_count( $strip_tags_content ); $reading_time = ceil( $word_count / 220 ); return $reading_time; } } if ( ! function_exists( 'bevro_post_date' ) ){ /** * Function to get Date of Post * * @return html Markup. */ function bevro_post_date(){ $output = ''; $format = apply_filters( 'bevro_post_date_format', '' ); $time_string = esc_html( get_the_date( $format ) ); $modified_date = esc_html( get_the_modified_date( $format ) ); $posted_on = sprintf( esc_html( '%s' ), $time_string ); $modified_on = sprintf( esc_html( '%s' ), $modified_date ); $output .= ''; $output .= ' ' . $posted_on . ''; //$output .= ' ' . $modified_on . ''; $output .= ''; return apply_filters( 'bevro_post_date', $output ); } } if ( ! function_exists( 'bevro_post_author' ) ){ /** * Function to get Author of Post * * @param string $output_filter Filter string. * @return html Markup. */ function bevro_post_author( $output_filter = '' ){ $output = ''; $byline = sprintf( esc_html( '%s' ), ' ' ); $output .= ''; return apply_filters( 'bevro_post_author', $output, $output_filter ); } } /** * Read more text. * * @param string $text default read more text. * @return string read more text */ function bevro_read_more_text( $text ){ $read_more = get_theme_mod( 'bevro_blog_read_more_txt' ); if ( '' != $read_more ){ $text = $read_more; } return $text; } add_filter( 'bevro_post_read_more', 'bevro_read_more_text'); /** * Function to get Read More Link of Post * * @since 1.0.0 * @return html */ if ( ! function_exists( 'bevro_post_link' ) ){ /** * Function to get Read More Link of Post * * @param string $output_filter Filter string. * @return html Markup. */ function bevro_post_link( $output_filter = '' ){ $enabled = apply_filters( 'bevro_post_link_enabled', '__return_true' ); if ( ( is_admin() && ! wp_doing_ajax() ) || ! $enabled ){ return $output_filter; } $bevro_read_more_text = apply_filters( 'bevro_post_read_more', __( 'Read More »', 'bevro' ) ); $read_more_classes = apply_filters( 'bevro_post_read_more_class', array() ); $post_link = sprintf( esc_html( '%s' ), ' ' . the_title( '', '', false ) . $bevro_read_more_text . '' ); $output = ' …
' . $post_link . '
'; return apply_filters( 'bevro_post_link', $output, $output_filter ); } } add_filter( 'excerpt_more', 'bevro_post_link', 1 ); /** * Function to get Number of Comments of Post * * @since 1.0.0 * @return html */ if ( ! function_exists( 'bevro_post_comments' ) ) { /** * Function to get Number of Comments of Post * * @param string $output_filter Output filter. * @return html Markup. */ function bevro_post_comments( $output_filter = '' ) { $output = ''; ob_start(); if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { ?> ' . $tags_list . ''; } return apply_filters( 'bevro_post_tags', $output, $output_filter ); } } /** * Function to get Categories of Post * * @since 1.0.0 * @return html */ if ( ! function_exists( 'bevro_post_categories' ) ) { /** * Function to get Categories applied of Post * * @param string $output_filter Output filter. * @return html Markup. */ function bevro_post_categories( $output_filter = '' ){ $output = ''; /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( __( ', ', 'bevro' ) ); if ( $categories_list ) { $output .= '' . $categories_list . ''; } return apply_filters( 'bevro_post_categories', $output, $output_filter ); } } /** * Prints HTML with meta information for the current post-date/time and author. */ if ( ! function_exists( 'bevro_blog_get_post_meta' ) ){ /** * Prints HTML with meta information for the current post-date/time and author. * * @since 1.0 * @return mixed Markup. */ function bevro_blog_get_post_meta() { $enable_meta = apply_filters( 'bevro_blog_post_meta_enabled', '__return_true' ); $post_meta = bevro_get_option( 'bevro-blog-meta' ); $post_meta_seprator = get_theme_mod( 'bevro_blog_meta_seprator','/' ); if ( 'post' == get_post_type() && is_array( $post_meta ) && $enable_meta ) { $output_str = bevro_get_post_meta( $post_meta, $post_meta_seprator); if ( ! empty( $output_str ) ) { echo apply_filters( 'bevro_blog_post_meta', '', $output_str ); // WPCS: XSS OK. } } } } /** * Excerpt count. * * @param int $length default count of words. * @return int count of words */ function bevro_excerpt_length( $length ){ $excerpt_length = (string) get_theme_mod( 'bevro_blog_expt_length' ); if ( '' != $excerpt_length ) { $length = $excerpt_length; } return $length; } add_filter( 'excerpt_length','bevro_excerpt_length', 999 ); /** * Read more class. * * @param array $class default classes. * @return array classes */ function bevro_read_more_class( $class ) { $read_more_button = get_theme_mod( 'bevro_main_read_more_btn' ); if ( $read_more_button ) { $class[] = 'brv-button'; } return $class; } add_filter( 'bevro_post_read_more_class','bevro_read_more_class', 999 ); /** * Display Blog Post Excerpt */ if ( ! function_exists( 'bevro_the_excerpt' ) ){ /** * Display Blog Post Excerpt * * @since 1.0.0 */ function bevro_the_excerpt(){?>