', $end_tag = ''){ global $wpdb; $category = str_replace(",", "','", $category); $category = "'" . $category . "'"; $query = "select wtr.object_id , wp.id, wp.post_title, wt.name, wp.post_modified, wp.post_date, wp.post_name from " . $wpdb->prefix."posts wp, " . $wpdb->prefix."term_relationships wtr, " . $wpdb->prefix."term_taxonomy wtt, " . $wpdb->prefix."terms wt where wp.id = wtr.object_id and wtr.term_taxonomy_id = wtt.term_taxonomy_id and wtt.term_id = wt.term_id and upper(wt.name) in (" . strtoupper($category) . ") AND wtt.taxonomy like 'category' AND wp.post_status = 'publish' AND wp.post_type like 'post' AND wp.post_password ='' ORDER BY wp.post_date DESC LIMIT 0," . $limit; //echo $query; $latest_posts = $wpdb->get_results($query); if ($latest_posts) { foreach ($latest_posts as $latest_post) { $post_title = $latest_post->post_title; $permaLink = get_permalink($latest_post->id); $html = $start_tag . "" .$post_title . " " . $end_tag; echo $html; } } } ?>