Hello all,
I have this problem : I want to include a specific category in a function, so that only the posts in that category will be shown. What i have is :
f (!function_exists('wpListPopularPosts')) {
function wpListPopularPosts($numberPosts=7) {
global $wpdb;
$cat_id = 4; //category id
$myposts = $wpdb->get_results("SELECT $wpdb->posts.post_title, $wpdb->posts.post_content, $wpdb->posts.post_date, $wpdb->posts.ID FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' ORDER BY $wpdb->posts.comment_count DESC LIMIT ".$numberPosts, OBJECT);
And the function continues, but I think it somewhere in the way I should get the $cat_id = 4; inside the WHERE part of the query
This doesnt work so far ... any one got a solution for this issue? You help is much appreciated.