File: /web/data/blog.tbbbearing.com/wp-content/themes/boke-1/template-parts/content-single.php
<?php
/**
* Template part for displaying posts.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package boke-1
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php
if ( is_single() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
endif;
if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta">
<span class="entry-category"><?php boke_1_first_category(); ?></span>
<span class="entry-author"><?php esc_html_e( 'Author: ', 'boke-1' ); ?><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>"><?php echo get_the_author_meta('nickname'); ?></a></span>
<span class="entry-date"><?php echo esc_html(get_the_date()); ?> <?php the_time( 'G:i' ); ?></span>
<span class="meta-right">
<span class="entry-views"><?php echo boke_1_get_post_views(get_the_ID()); ?></span>
<span class="entry-comment"><?php comments_popup_link( esc_html__('Review','boke-1'), esc_html__('1 Review', 'boke-1'), esc_html__('% Review', 'boke-1'), 'comments-link', esc_html__('Comment has been closed', 'boke-1'));?></span>
</span>
</div><!-- .entry-meta -->
<?php
endif; ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php
//if ( has_post_thumbnail() ) :
// the_post_thumbnail('boke_1_post_thumb');
//endif;
?>
<?php
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( 'Read the full %s <span class="meta-nav">→</span>', 'boke-1' ), array( 'span' => array( 'class' => array() ) ) ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
) );
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Page:', 'boke-1' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<div class="entry-tags">
<?php if (has_tag()) { ?><span class="tag-links"><?php esc_html_e( 'Tags: ', 'boke-1' ); ?><?php the_tags(' ', ' '); ?></span><?php } ?>
<?php
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'boke-1' ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
),
'<span class="edit-link">',
'</span>'
);
?>
</div><!-- .entry-tags -->
</article><!-- #post-## -->
<?php
// Get the taxonomy terms of the current page for the specified taxonomy.
$terms = wp_get_post_terms( get_the_ID(), 'category', array( 'fields' => 'ids' ) );
// Bail if the term empty.
if ( empty( $terms ) ) {
return;
}
// Posts query arguments.
$query = array(
'post__not_in' => array( get_the_ID() ),
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => $terms,
'operator' => 'IN'
)
),
'posts_per_page' => 6,
'post_type' => 'post',
);
// Allow dev to filter the query.
$args = apply_filters( 'revenue_pro_related_posts_args', $query );
// The post query
$related = new WP_Query( $args );
if ( $related->have_posts() ) : $i = 1; ?>
<div class="entry-related clear">
<h3><?php esc_html_e('Recommend', 'boke-1'); ?></h3>
<div class="related-loop clear">
<?php while ( $related->have_posts() ) : $related->the_post(); ?>
<?php
$class = ( 0 == $i % 3 ) ? 'hentry last' : 'hentry';
?>
<div class="<?php echo esc_attr( $class ); ?>">
<?php if ( has_post_thumbnail() ) { ?>
<a class="thumbnail-link" href="<?php the_permalink(); ?>">
<div class="thumbnail-wrap">
<?php
the_post_thumbnail();
?>
</div><!-- .thumbnail-wrap -->
</a>
<?php } ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</div><!-- .grid -->
<?php $i++; endwhile; ?>
</div><!-- .related-posts -->
</div><!-- .entry-related -->
<?php endif;
// Restore original Post Data.
wp_reset_postdata();
?>