__( 'Just a simple widget that displays recent comments.', 'vh' ), )
);
}
// Creating widget front-end
// This is where the action happens
public function widget( $args, $instance ) {
global $post, $wpdb, $wp_query;
$maintitle = $instance['maintitle'];
$limit = $instance['limit'];
$thePostID = $wp_query->post->ID;
// before and after widget arguments are defined by themes
echo $args['before_widget'];
if ( !empty($maintitle) ) {
echo '
';
echo '
' . $maintitle . '
';
echo '
';
}
if ( empty($limit) ) {
$limit = 5;
}
$querystr = "SELECT comment_author, comment_author_email, comment_content, comment_post_ID FROM " . $wpdb->prefix . "comments ORDER BY comment_date DESC LIMIT ".$limit;
$queryresults = $wpdb->get_results($querystr);
if ( !empty($queryresults) ) {
echo "