How to apply view count manually
-
Hello,
Please have been trying to set a view count to some of my post manually using the CUSTOM FIELDS section, but it will not reflect after setting the number.
How do I go about this.
Here is the code section in the function.php which i think need tweaking
(what do i set here to get the manually set number)}
//get video meta count
if(!function_exists(‘tm_html_video_meta’)){
function tm_html_video_meta($single = false, $label = false, $break = false, $listing_page = false, $post_id = false){
global $post;
$post_id = $post_id?$post_id:get_the_ID();
ob_start();
$view_count = get_post_meta($post_id, ‘_count-views_all’, true);
if($single==’view’){
echo ‘<span class=”pp-icon”><i class=”fa fa-eye”></i> ‘.($view_count?$view_count:0).'</span>’;
}elseif($single==’like’){
if(function_exists(‘GetWtiLikeCount’)){
echo ‘<span class=”pp-icon iclike”><i class=”fa fa-thumbs-up”></i> ‘.str_replace(‘+’,”,GetWtiLikeCount($post_id)).'</span>’;
}
}elseif($single==’comment’){
echo ‘<span class=”pp-icon”><i class=”fa fa-comment”></i> ‘.get_comments_number($post_id).'</span>’;
}elseif($listing_page){
if(ot_get_option(‘blog_show_meta_view’,1)){?>
<span><i class=”fa fa-eye”></i> <?php echo ($view_count?$view_count:0).($label?__(‘ Views’):”) ?></span><?php echo $break?’
‘:” ?>
<?php }
if(ot_get_option(‘blog_show_meta_comment’,1)){?>
<span><i class=”fa fa-comment”></i> <?php echo get_comments_number($post_id).($label?__(‘ Comments’):”); ?></span><?php echo $break?’
‘:” ?>
<?php }
if(ot_get_option(‘blog_show_meta_like’,1)&&function_exists(‘GetWtiLikeCount’)){?>
<span><i class=”fa fa-thumbs-up”></i> <?php echo str_replace(‘+’,”,GetWtiLikeCount($post_id)).($label?__(‘ Likes’):”); ?></span>
<?php
}
}else{?>
<span><i class=”fa fa-eye”></i> <?php echo ($view_count?$view_count:0).($label?__(‘ Views’):”) ?></span>
<?php echo $break?’
‘:” ?>
<span><i class=”fa fa-comment”></i> <?php echo get_comments_number($post_id).($label?__(‘ Comments’):”); ?></span>
<?php echo $break?’
‘:” ?>
<?php if(function_exists(‘GetWtiLikeCount’)){?>
<span><i class=”fa fa-thumbs-up”></i> <?php echo str_replace(‘+’,”,GetWtiLikeCount($post_id)).($label?__(‘ Likes’):”); ?></span>
<?php }
}
$html = ob_get_clean();
return $html;
}
}
- The topic ‘How to apply view count manually’ is closed to new replies.