• Resolved raykart

    (@raykart)


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

    <?php
                          # 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
                        ?>
                        <ul>
                        <?
                          $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);
                          }
                        ?>
                        </ul>

    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!

  • The topic ‘Front Page – blog post links with lates post having an excerpt’ is closed to new replies.