WordPress.org

Ready to get started?Download WordPress

Forums

Display Recent Comments on Static HTML Page (1 post)

  1. neekee
    Member
    Posted 6 years ago #

    Hello

    I am using this code found on this site on my front page to display my 5 latest posts:

    <?php
    $how_many=5; //How many posts do you want to show
    require_once("nikisiou/wp-config.php"); // Change this for your path to wp-config.php file ?>
    <ol id="whats-new">
    <?
    $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts
    WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>= \"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>");
    } ?>
    </ol>

    I would like the same thing with the latest comments.

    Anyone feel like coding that ? Thanks in advance =)

Topic Closed

This topic has been closed to new replies.

About this Topic