Use this in the loop:
getPostViews(get_the_ID());
instead of:
bac_PostViews(get_the_ID());
So your loop should be like this:
<?php $catquery = new WP_Query(array(
'meta_key' => 'post_views_count',
'orderby' => 'meta_value_num',
'posts_per_page' => 5,
'cat' => '52',
)); ?>
<ol class="topheadlines">
<?php while($catquery->have_posts()) : $catquery->the_post(); ?>
<!-- display view count -->
<?php if(function_exists('getPostViews')) {
echo getPostViews(get_the_ID());
}?>
<div class="row">
<div class="col-9" style="padding:0px 0px 0px 5px;">
<li class="topheadlines-text"><a href="https://wordpress.stackexchange.com/questions/364698/<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
</div>
<div class="col-3 topheadline-thumb" style="padding:0px 5px 0px 5px;">
<?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?>
</div>
</div>
<?php endwhile;
wp_reset_postdata();
?>
And in single.php you must call bac_PostViews function:
<?php
/**
* The template for displaying all single posts
*
* @package understrap
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
get_header();
$container = get_theme_mod( 'understrap_container_type' );
?>
<div class="row" style="margin:0;">
<div class="col-md-9 single-bg" style="padding:0;">
<div class="container-fluid">
<div class="single-wrap">
<h5 class="single-date">
<?php echo get_the_date(); ?>
</h5>
<h2 class="single-title">
<?php the_title(); ?>
</h2>
<h3 class="single-sub-title">
<?php echo the_field('mt_post_subtitle'); ?>
</h3>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="single-thumb">
<?php if(function_exists('bac_PostViews')) {
echo bac_PostViews(get_the_ID());
}?>
<?php $category = get_the_category();
$firstCategory = $category[0]->cat_name;
?>
<?php if($firstCategory != 'Daily (Email)') { ?>
<?php echo get_the_post_thumbnail( $post->ID, 'large' );
}
?>
</div>
<div class="single-content">
<?php the_content(); ?>
</div>
<?php
$author_id = get_the_author_meta('ID');
$author_badge = get_field('author_badge', 'user_'. $author_id );
?>
<div class="author-wrap clearfix">
<div class="author-pic">
<a href="https://wordpress.stackexchange.com/questions/364698/<?php echo esc_url( get_author_posts_url( get_the_author_meta("ID' ) ) ); ?>" title="<?php echo esc_attr( get_the_author() ); ?>">
<?php echo get_avatar( get_the_author_meta( 'ID' ) , 50 ); ?>
</a>
</div>
<h5 class="author-name">
<a href="https://wordpress.stackexchange.com/questions/364698/<?php echo esc_url( get_author_posts_url( get_the_author_meta("ID' ) ) ); ?>" title="<?php echo esc_attr( get_the_author() ); ?>">
<?php the_author(); ?><br><span class="author-title"><?php the_field('title', 'user_'. $author_id ); ?>, The Hustle</span>
</a>
</h5>
</div><!-- end author wrap -->
<?php endwhile; ?>
<?php endif; ?>
<?php $category = get_the_category();
$firstCategory = $category[0]->cat_name;
?>
<?php if($firstCategory == 'Daily (Email)') { ?>
<a href="http://wordpress.stackexchange.com/daily">
<button type="button" class="btn btn-primary single-read-more"><?php echo $button_text; ?>Related Posts</button>
</a>
<?php
}
?>
<?php if($firstCategory == 'Stories') { ?>
<a href="http://wordpress.stackexchange.com/stories">
<button type="button" class="btn btn-primary single-read-more"><?php echo $button_text; ?>Related Posts</button>
</a>
<?php
}
?>
<?php if($firstCategory == 'Blog') { ?>
<a href="http://wordpress.stackexchange.com/blog">
<button type="button" class="btn btn-primary single-read-more"><?php echo $button_text; ?>Related Posts</button>
</a>
<?php
}
?>
<?php if($firstCategory == 'Episodes') { ?>
<a href="https://wordpress.stackexchange.com/">
<button type="button" class="btn btn-primary single-read-more"><?php echo $button_text; ?>Related Posts</button>
</a>
<?php
}
?>
<?php if($firstCategory == '') { ?>
<a href="https://wordpress.stackexchange.com/">
<button type="button" class="btn btn-primary single-read-more"><?php echo $button_text; ?>Related Posts</button>
</a>
<?php
}
?>
<?php if($firstCategory == 'Uncategorized') { ?>
<a href="https://wordpress.stackexchange.com/">
<button type="button" class="btn btn-primary single-read-more"><?php echo $button_text; ?>Related Posts</button>
</a>
<?php
}
?>
<?php if($firstCategory == 'Brief') { ?>
<a href="http://wordpress.stackexchange.com/series/brief">
<button type="button" class="btn btn-primary single-read-more"><?php echo $button_text; ?>Related Posts</button>
</a>
<?php
}
?>
<div class="recent-wrap">
<h4 class="featured-headlines">
Recent Posts
</h4>
<?php echo do_shortcode('[recent_post_carousel design="design-1" category="52,6"]'); ?>
</div><!-- end recent wrap -->
</div><!-- end singlewrap -->
</div><!-- end container fluid -->
</div><!-- end col 9 -->
<div class="col-md-3" style="padding:0; margin:0;">
<?php include get_template_directory() . '/inc/page-sidebar.php'; ?>
</div><!-- end col 3 sidebar -->
</div> <!-- end master row -->
<?php get_footer();