WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_list_comments (3 posts)

  1. ckruse
    Member
    Posted 4 years 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!

  2. Justin Tadlock
    Member
    Posted 4 years ago #

    This shouldn't go in The Loop:

    wp_list_comments('type=comment&callback=lp_comment');

    It should go within your comments.php template.

    Read this article for a good tutorial:
    http://ottodestruct.com/blog/2008/09/29/wordpress-27-comments-enhancements/

  3. ckruse
    Member
    Posted 4 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic