How do I append to the end of the comments array in WordPress?
I'm trying to include something at the end of the comments array for a WordPress plugin.
I currently have add_filter('comments_array', 'my_function')
, where my_function($comments='')
is something along the lines of:
my_function($comments='') {
echo 'something';
return $comments;
}
I obviously can't return the comments first, and echoing them doesn't work because $comments
is a multi-dimensional array. Is there some way I can print the WordPress comme开发者_StackOverflow中文版nts and then append something to them?
Thanks.
You want to add something that looks like a comment or add arbitrary html under each comment block?
Can you add to the page template(s) what you want to appear under the comments block? I.e.,
<?php comments_template(); ?>
html or php here
<?php endwhile; else: ?>
精彩评论