Mini loop with post titles from 1 category
-
I’ve got a mini-loop running on the welcome page of my blog:
<?
ID
$news=$wpdb->get_results("SELECT,
post_titleFROM $wpdb->posts
post_status
WHERE= \"publish\" ORDER BY 'ID' DESC LIMIT ".$how_many);
foreach($news as $np)
{
print ("<li><a href=\"");
echo get_permalink($np->ID);
print ("\">$np->post_title</a></li>");
}
?>Is it possible to have the titles from 1 certain category displayed? The loop above displays the last 6 posts, but I would like to display the last 6 posts in a certain category …
I’m thinking
AND post_category = something
, but! when I look in the WordPress MySQL database, I see that the column for post_category is always zero…Anyone an idea on how to have just posts from a certain category displayed?
- The topic ‘Mini loop with post titles from 1 category’ is closed to new replies.