0

I'm trying to display comment meta under each comment, but I couldn't find which action should I hook in.

2 Answers 2

1

You will need get_comment_meta to pull that information from the database. You will need to know the metakey. If you don't have that, you will have to search the theme/plugin that generates the metadata for the occurence of add_comment_meta to find it.

Where to hook depends on how your theme is listing the comments. If it simply uses wp_list_comments there is no filter to simply attach the metadata. You will need to change the callback argument using the wp_list_comments_args filter. Then you can make a callback function that specifies which comment and meta data to display and how (learn more).

1
  • thanks for both editing and comments. I'm trying to figure that out.
    – Kimsea Sok
    Aug 22, 2018 at 2:39
0

As an easier alternative, you can use flexbox to reorder the comment items:

.comment-list article {
    display: flex;
    flex-wrap: wrap;
}

.comment-list .comment-meta,
.comment-list .comment-content {
    flex: 0 0 100%;
}

.comment-list .comment-meta {
    order: 2;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.