• I’m using a miniloop on my static frontpage.
    This is the code for this miniloop:
    <?
    $news=$wpdb->get_results("SELECT
    ID,post_title FROM $wpdb->posts
    WHERE
    post_status= \"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?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Mini loop on static frontpage’ is closed to new replies.