• I want to display links to my latest posts on a static front page and found this which has been really helpful: https://codex.www.ads-software.com/Creating_a_Static_Front_Page

    So now I have this:

    <?php
    $how_many=10; //How many posts do you want to show
    require_once(“journal/wp-config.php”); // Change this for your path to wp-config.php file ?>

    <?
    $news=$wpdb->get_results(“SELECT ID,post_title FROM $wpdb->posts<br />
    WHERE
    post_status`= \”publish\” ORDER BY ‘ID’ DESC LIMIT “.$how_many);
    foreach($news as $np){
    printf (“<dl><dt><span class=\”date\”>%s</span>%s</dt><dd>%s</dd></dl>”, $np->ID,$np->post_title);
    }?>

    I would like to add date and an excerpt next to each post title. Any help would be much appreciated.

  • The topic ‘Help with mini loop needed please’ is closed to new replies.