Mini loop on static frontpage
-
I’m using a miniloop on my static frontpage.
This is the code for this miniloop:
<?
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>");
}?>This displayes the last 6 posts on my weblog in a small list. This is cool and works like a charm.
But, however, I would like to have displayed the most recent posts in a certain category (e.g. “Software”)
I tried adding the following code to that miniloop
WHERE
post_status= \"publish\" AND
post_category= \"Software\" ORDER BY 'ID' DESC LIMIT ".$how_many);
But that doesn’t work, it keeps displaying posts from all caterogies.
I went to my PHPadmin, and took a look at the wp_post table, and found that the column “post_caterogy” is always “0”, I guess that’s the reason why my code isn’t working…
How do proceed?
- The topic ‘Mini loop on static frontpage’ is closed to new replies.