• Hey Guys,

    If you look at my website (https://www.wizzhack.co.uk) I have a pull down menu, Categories and the code is:

    <?php wp_list_categories('sort_column=name&title_li='); ?>

    Whats the one to show most recent comments?

    Thanks,

    WizzKid

Viewing 4 replies - 1 through 4 (of 4 total)
  • There is no template tag for recent comment, but there is a Widget. Of course you could look at wp-includes/widgets.php to see how it ‘gets done’.

    There’s also plugins that will handle recent comments.
    See Plugins/Archive

    Thread Starter WizzKid

    (@wizzkid)

    Thanks very much,

    Was looking at:

    And it seems to be: https://www.semiologic.com/software/widgets/recent-comments/

    <?php the_recent_comments(); ?>

    Thanks,

    WizzKid

    Thread Starter WizzKid

    (@wizzkid)

    Thought I had it, but didnt ?? I will look into it more!

    You can’t use that tag on its own. You have to install the plugin to go with it, and then it works.

    I have my own ‘hack’ for this… although I don’t know which puts less load on the server:


    <?php
    $query1 = "
    SELECT wp_comments.comment_ID, wp_comments.comment_author, wp_comments.comment_post_ID, wp_posts.post_title FROM wp_comments, wp_posts
    WHERE wp_comments.comment_post_ID = wp_posts.ID AND wp_comments.comment_approved = '1'
    ORDER BY wp_comments.comment_date_gmt DESC LIMIT 15";
    $result1 = mysql_query($query1);
    while ($r1 = mysql_fetch_array($result1)) {
    extract($r1);
    echo "$comment_author on <i>$post_title</i>

    ";
    }
    mysql_free_result($result1);
    ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP Help’ is closed to new replies.