New here? You may want to subscribe to the (free) ABDPBT Tech RSS Feed. For an explanation of how RSS subscriptions work, please see this explanatory post. Or, you can sign up to receive new ABDPBT Tech posts by email (also free).

Let’s say you want to have a featured comments/recent comments section in WordPress, but you don’t want to use a plugin. All you’ve got to do is paste the following code into your theme wherever you want the comments to appear. The code (as is) will show you the most recent 5 comments, but if you want to change the number, simply change the 5 on the third line to whatever number you want. (Via WPRecipes.) Cool!

<?php
$query = "SELECT * from $wpdb->comments WHERE comment_approved= '1'
ORDER BY comment_date DESC LIMIT 0 ,5";
$comments = $wpdb->get_results($query);

if ($comments) {
    echo '<ul>';
    foreach ($comments as $comment) {
        $url = '<a href="'. get_permalink($comment->comment_post_ID).'#comment-'.$comment->comment_ID .'" title="'.$comment->comment_author .' | '.get_the_title($comment->comment_post_ID).'">';
        echo '<li>';
        echo '<div class="img">';
        echo $url;
        echo get_avatar( $comment->comment_author_email, $img_w);
        echo '</a></div>';

        echo '<div class="txt">Par: ';
        echo $url;
        echo $comment->comment_author;
        echo '</a></div>';
        echo '</li>';
    }
    echo '</ul>';
}
?>

Remember The Milk

by anna on January 13, 2010

in of note

remember the milk

Remember The Milk is an online tool for getting things done that probably everyone already knows about except for me. Remember the Milk can track your tasks and to-do lists on its own, but the Twitter app is especially useful: it allows you to add things to your to-do list directly from Twitter. Once it is set up, all you have to do is @reply to Remember the Milk to add a new item. As much as I like Google Calendar, I don’t think it boasts any way of updating that is this simple.