[resolved] Front Page - blog post links with lates post having an excerpt (1 post)

  1. raykart
    Posted 9 years ago #

    Hey guys, I'm building a static front page in wp2.2 and have this code to get latest blog posts:

                          # Here starts Mini Loop trick: You can use this code, but _at your own risk_
                          # If you want to improve this code, you're welcome ;)
                          $how_many=5; //How many posts do you want to show
                          $news=$wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts
                            WHERE post_status = \"publish\" and post_type = \"post\" ORDER BY ID DESC LIMIT " . $how_many);
                          foreach($news as $np){
                            printf ("<li><a href=\"index.php?p=%s\">%s</a></li>", $np->ID,$np->post_title);

    Now, I'm wondering how can I customise it so I can have an excerpt from latest blog post and the rest as just links? I also need the title above the latest post excerpt too...

    Thank you in advance!

Topic Closed

This topic has been closed to new replies.

About this Topic