File: /www/wwwroot/njmuedu.com/wp-content/themes/blogrank-pro/template-parts/content-single.php
<?php
/**
* Template part for displaying posts.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package blogrank
*/
?>
<?php if ( blogrank_option('single-breadcrumbs-on', true) == true) : ?>
<div class="breadcrumbs-nav">
<a href="<?php echo esc_url(home_url()); ?>"><?php esc_html_e('Home', 'blogrank'); ?></a>
<span class="post-category"><?php blogrank_first_category(); ?></span>
<span class="post-title"><?php the_title(); ?></span>
</div>
<?php endif; ?>
<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() ) : ?>
<?php get_template_part( 'template-parts/entry-meta', 'single' ); ?>
<?php
endif; ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php
if ( blogrank_option('single-top-ad-on',true) && blogrank_option('single-top-ad-code') ) {
echo '<div class="custom-ad single-top-ad">' . blogrank_option('single-top-ad-code') . '</div>';
}
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( 'Continue reading %s <span class="meta-nav">→</span>', 'blogrank' ), 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__( 'Pages:', 'blogrank' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<div class="entry-footer">
<span class="entry-tags">
<?php if (has_tag()) { ?><span class="tag-links"><?php the_tags(' ', ' '); ?></span><?php } ?>
<?php
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'blogrank' ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
),
'<span class="edit-link">',
'</span>'
);
?>
</span><!-- .entry-tags -->
</div><!-- .entry-footer -->
<?php
if ( blogrank_option('single-bottom-ad-on',true) && blogrank_option('single-bottom-ad-code') ) {
echo '<div class="custom-ad single-bottom-ad">' . blogrank_option('single-bottom-ad-code') . '</div>';
}
?>
</article><!-- #post-## -->
<?php if ( blogrank_option('single-author-box-on', true) == true) : ?>
<div class="author-box clear">
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ) ); ?>"><?php echo get_avatar( get_the_author_meta( 'ID' ), 120 ); ?></a>
<div class="author-meta">
<h4 class="author-name"><span><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ) ); ?>"><?php the_author_meta('display_name'); ?></a></span></h4>
<div class="author-desc">
<?php
echo esc_html( the_author_meta('description') );
?>
</div>
</div>
</div><!-- .author-box -->
<?php endif; ?>
<?php if ( blogrank_option('single-related-on', true) == true) : ?>
<?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.
if (blogrank_option('related-type', 'category') == 'tag') {
$post_tag = get_the_tags ( $post->ID );
// Define an empty array
$ids = array();
// Check if the post has any tags
if ( $post_tag ) {
foreach ( $post_tag as $tag ) {
$ids[] = $tag->term_id;
}
}
$query = array(
'post__not_in' => array( get_the_ID() ),
'post_type' => 'post',
'tag__in' => $ids,
'posts_per_page' => blogrank_option('related-num', 10),
);
} else {
$query = array(
'post__not_in' => array( get_the_ID() ),
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => $terms,
'operator' => 'IN'
)
),
'posts_per_page' => blogrank_option('related-num', 10),
'post_type' => 'post',
);
}
// Allow dev to filter the query.
$args = apply_filters( 'blogrank_related_posts_args', $query );
// The post query
$related = new WP_Query( $args );
if ( $related->have_posts() ) : $i = 1; ?>
<div class="entry-related">
<h3><?php echo blogrank_option('single-related-title', 'Related Posts'); ?></h3>
<div class="content-loop related-loop clear">
<?php while ( $related->have_posts() ) : $related->the_post(); ?>
<?php get_template_part('template-parts/content', 'loop'); ?>
<?php $i++; endwhile; ?>
</div><!-- .related-loop -->
</div><!-- .entry-related -->
<?php endif;
// Restore original Post Data.
wp_reset_postdata();
?>
<?php endif; ?>