%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() ) ); $timeIcon = '%1$s'; $posted_on = sprintf( $timeIcon, '' . $time_string . '' ); echo ' ' . $posted_on . ''; // WPCS: XSS OK. } endif; if ( ! function_exists( 'blog_starter_time' ) ) { function blog_starter_time() { $time_string = ''; 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() ) ); echo '' . $time_string . ''; } } if ( ! function_exists( 'blog_starter_posted_by' ) ) : /** * Prints HTML with meta information for the current author. */ function blog_starter_posted_by($author_image = true) { $posted_by_format = '%2$s %3$s'; $post_author_id = get_post_field( 'post_author', get_queried_object_id() ); $get_author_image = ''; if (false === $author_image) { $get_author_image = __('Posted by', 'blog-starter'); } $postedBy = sprintf( $posted_by_format, esc_url( get_author_posts_url( get_the_author_meta( $post_author_id ))), $get_author_image, ''.esc_html( get_the_author_meta('display_name', $post_author_id)).'' ); echo ''.$postedBy.''; } endif; if ( ! function_exists( 'blog_starter_comment_popuplink' ) ) { function blog_starter_comment_popuplink() { if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { // $commentIcon = ; echo ''; $css_class = 'zero-comments'; $number = (int) get_comments_number( get_the_ID() ); if ( 1 === $number ) $css_class = 'one-comment'; elseif ( 1 < $number ) $css_class = 'multiple-comments'; comments_popup_link( __( 'Post a Comment', 'blog-starter' ), __( '1 Comment', 'blog-starter' ), __( '% Comments', 'blog-starter' ), $css_class, __( 'Comments are Closed', 'blog-starter' ) ); echo ''; } } } function blog_starter_categories(){ if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ', ', 'blog-starter' ) ); if ( $categories_list ) { /* translators: 1: list of categories. */ printf( '' . '%1$s' . '', $categories_list ); // WPCS: XSS OK. } } return; } if ( ! function_exists( 'blog_starter_post_tag' ) ) { function blog_starter_post_tag() { 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-starter' ) ); if ( $tags_list ) { /* translators: 1: list of tags. */ printf( '' . esc_html__( 'Tagged %1$s', 'blog-starter' ) . '', $tags_list ); // WPCS: XSS OK. } } return; } } if ( ! function_exists( 'blog_starter_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_starter_post_thumbnail() { $post_thumnail = wp_get_attachment_image_url( get_post_thumbnail_id( get_the_ID() ), 'blog_starter-thumbnail' ); if ( has_post_thumbnail() ) : ?> '; endif; } endif; function blog_starter_cats_related_post() { $post_id = get_the_ID(); $cat_ids = array(); $categories = get_the_category( $post_id ); if(!empty($categories) && is_wp_error($categories)): foreach ($categories as $category): array_push($cat_ids, $category->term_id); endforeach; endif; $current_post_type = get_post_type($post_id); $query_args = array( 'category__in' => $cat_ids, 'post_type' => $current_post_type, 'post_not_in' => array($post_id), 'posts_per_page' => '4' ); $related_cats_post = new WP_Query( $query_args ); if($related_cats_post->have_posts()): ?>

'; while($related_cats_post->have_posts()): $related_cats_post->the_post(); ?>

'; // Restore original Post Data wp_reset_postdata(); endif; }