• Resolved sandeep4688

    (@sandeep4688)


    <ol class="commentlist">
    <?php wp_list_comments(); ?>
    </ol>

    Somebody pls. tell me how to format above.( name, comments and pic).

Viewing 7 replies - 1 through 7 (of 7 total)
  • kdesign

    (@kdesign)

    Hi t31os,

    I’m experiencing the same dilemma. Is a custom callback the only way to do it? I am trying to have my comments look like the comments in this blog: https://www.justinmarantz.com/ (you may need to scroll down to the end of a post to see it).

    Currently my comments have the name, a break, a comment, another break, and the date. But I’d like mine to have the same order as the comments in that blog. To change the order, will you need to create a custom callback?

    If you want control over the elements output by wp_list_comments, then yes, as far as i know, a custom callback is the only way to do it.

    The alternative would be to write your own query to the database to get the data, and do your own stuff with it from there.

    The callback being the easier option..

    Hi, I tried it and understand it, but for some reason can’t figure out why I keep getting an error message.

    Basically, I have an originally empty functions.php file in which I copied and pasted what is in the Codex as you’ve linked above. Then I modified comments.php with

    <ul class=”commentlist”>
    <?php wp_list_comments(‘type=comment&callback=mytheme_comment’); ?>

    in replacement of

    <ul class=”commentlist”>
    <?php wp_list_comments(); ?>

    Whenever I update functions.php I keep receiving this error though:

    Parse error: syntax error, unexpected ‘}’ in /home7/kd/public_html/wp-content/themes/ejstheme/functions.php on line 26

    Have you ever experienced this? Any help would be much appreciated! And if it helps, I’m using version 2.9.2.

    Thanks.

    If you’ve copied the example “as is”, you’ll need to make a small adjustment..

    Open your functions file, and adjust the top lines to look like so..

    <?php
    function mytheme_comment($comment, $args, $depth) {

    That should be it.. ??

    thanks, it worked. styling it is another story though! it’s still not as straightforward as i thought it would be. i’m trying to wrap the comment around the author name which is more difficult than i thought since ‘comment author vcard’ is in a div and comment_text() spits out a paragraph in the html that i can’t get to wrap. i assumed i could apply a ‘float: left;’ property to the comment author vcard div class (or cite, .fn–trying different things) but nothing productive yet. Ah, it never ends! I’ll have to figure more ways to style comments. Thanks for your help. ??

    If you’re able to post a URL to the page, perhaps myself or another user may be able to suggest some CSS tweaks to help you along…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘how to format php wp_list_comments( ) ?’ is closed to new replies.