Hello,
You can show all recent comments of your site with a function. Paste this function in your theme’s function.php
function wcz_recent_comments($no_comments = 15, $comment_len = 80, $avatar_size = 20) {
$comments_query = new WP_Comment_Query();
$comments = $comments_query->query( array( 'number' => $no_comments ) );
$comm = '';
if ( $comments ) : foreach ( $comments as $comment ) :
$comm .= '<li>' . get_avatar( $comment->comment_author_email, $avatar_size );
$comm .= '<a href="' . get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID . '">';
$comm .= get_comment_author( $comment->comment_ID ) . ':</a> ';
$comm .= '' . strip_tags( substr( apply_filters( 'get_comment_text', $comment->comment_content ), 0, $comment_len ) ) . '</li>';
endforeach; else :
$comm .= 'No comments.';
endif;
echo $comm;
}
Now paste this in your theme where you want to show recent comments
<?php wcz_recent_comments(); ?>
You also asked for recent posts. Your home page shows recent posts of your site and author.php shows recent posts of a author. So I Think there no needs to make another template for it.
To hyper link comments number go to sb-login/template/logged-in.php
and turn this code into a hyper link
<li><strong><span style="color:#0176AB;"><?php _e('Total comments of yours:', 'sb-login'); ?></span></strong> <?php
global $wpdb, $current_user;
get_currentuserinfo();
$userId = $current_user->ID;
$where = 'WHERE comment_approved = 1 AND user_id = ' . $userId ;
$comment_count = $wpdb->get_var("SELECT COUNT( * ) AS total
FROM {$wpdb->comments}
{$where}");
echo '<strong>' . $comment_count . '</strong>';
?></li>