posts – Display a specific category in a focused area of my site
I’ve been trying to change the code of my wordpress site. Rather than show “trending posts” which is determined by post_views_count, I simply want to show posts from a certain category.
The code, as it stands is:
if ( !function_exists( ‘getCrunchifyPostViews’ ) ) {
function getCrunchifyPostViews($postID){
$count_key = ‘post_views_count’;
$count = get_post_meta($postID, $count_key, true);
if($count==”){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, ‘0’);
return “0 View”;
}
return $count.’ Views’;
}
}
if ( !function_exists( ‘setCrunchifyPostViews’ ) ) {
function setCrunchifyPostViews($postID) {
$count_key = ‘post_views_count’;
$count = get_post_meta($postID, $count_key, true);
if($count==”){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, ‘0’);
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
}
How can I simply get it to show posts of a certain category (fyi the category_name is ‘review’)
Thank you in advance!
Leave an answer