Site logo

Archived topic

Display comments in table

1 reply · Started by Franz on November 18, 2021

Viewing posts 1–2 of 2

Hello,
based on a custom function:

add_shortcode('my-post-comments', function($atts, $content){
if(!get_current_user_id()){ // guest user
return;
}
$args = array(
'post_author' => get_current_user_id(), // It will use the current logged in use to grab the comments
);
$comments = get_comments( $args );

// Referer to http://codex.wordpress.org/Function_Reference/wp_list_comments
$list_args = array(
'reverse_top_level' => false, // Show the latest comments at the top of the list
'echo' => false,
);
$res = wp_list_comments( $list_args, $comments );
return $res;
});

and the shortcode [my-post-comments] ...

I can display a list of comments on a selected page. But I would like to display comments in a table (not a list), and I would like to add more items in the table (comment, author, etc.). Can you suggest a solution? Generate press does not offer a template for comment-list-table?

Kind regards

Franz

Hi Franz,

Unfortunately I don't have any recommendation for this - something like this would require a custom solution and shouldn't be theme-specific.

And no GP doesn't offer a template for comment-list-table.

This archived topic is closed to new replies.