• Hi,

    I’m trying to add a comments-number for the wordpress recent comments-widget, but with the function from wordpress codex, “get_comments_number()”, it displays “0” every time, despite comments are beeing present on the posts.

    My small hack for the “default-widgets.php” currently looks like this:

    $output .= sprintf( _x( '%1$s on %2$s %3$s', 'widgets' ),
    '<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>',
    '<span class="comment-author-link">' . get_comment_date() . '</span>',
    '<span class="comments">' . get_comments_number() . '</span>'

    help is much appreciated

The topic ‘Add comments-number for recent comments widget’ is closed to new replies.