Forums
Forums / Themes and Templates / wp_list_comments
(@ckruse)
16 years, 10 months ago
I am having a crazy amount of trouble with wp_list_comments(). I am trying to create my own custom function to display comments.
Within the_loop I have:
wp_list_comments(‘type=comment&callback=lp_comment’);
Then, in my functions.php file I have:
function lp_comment($comment, $args, $depth) { $GLOBALS[‘comment’] = $comment; ?>
<p style=”white-space:nowrap”> <strong class=”w-name”><?php comment_author(); ?> <?php comment_text(); ?> <?php the_time(); ?> </p>
<?php }
It will not display anything. No matter where I put it. I have even tried calling lp_comment directly, which will throw an error stating that parameters are missing. But not so much as a space using wp_list_comments.
PLEASE HELP ME! I am going crazy!
Thanks!
(@greenshady)
This shouldn’t go in The Loop:
wp_list_comments('type=comment&callback=lp_comment');
It should go within your comments.php template.
comments.php
Read this article for a good tutorial: http://ottodestruct.com/blog/2008/09/29/wordpress-27-comments-enhancements/
Thanks. I just ended up writing my own function to query the comments table and display them formatted just as I like them. Works great!
The topic ‘wp_list_comments’ is closed to new replies.
(@ckruse)
16 years, 10 months ago
I am having a crazy amount of trouble with wp_list_comments(). I am trying to create my own custom function to display comments.
Within the_loop I have:
wp_list_comments(‘type=comment&callback=lp_comment’);
Then, in my functions.php file I have:
function lp_comment($comment, $args, $depth) {
$GLOBALS[‘comment’] = $comment; ?>
<p style=”white-space:nowrap”>
<strong class=”w-name”><?php comment_author(); ?>
<?php comment_text(); ?>
<?php the_time(); ?>
</p>
<?php
}
It will not display anything. No matter where I put it. I have even tried calling lp_comment directly, which will throw an error stating that parameters are missing. But not so much as a space using wp_list_comments.
PLEASE HELP ME! I am going crazy!
Thanks!