Support » Fixing WordPress » <?php wp_list_comments(); ?>

  • Resolved richarduk


    Is it possible to style <?php wp_list_comments(); ?> in comments.php?

    In the old comments loop it was possible to do more or less anything. For example adding numbers besides comments, adding different css styles to odd comments.

    In the new comments loop it looks like <?php wp_list_comments(); ?> outputs everything. Almost as if <?php wp_list_comments(); ?> is the loop itself

    < ?php if ( have_comments() ) : ?>
    <ul class="commentlist">
    < ?php wp_list_comments(); ?>
    < ?php else: ?>

    Have I misunderstood this?

    Editted: just found all the classes that are automatically added

    But I still feel that I’ve lost some of the control I had before

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve just had to do this myself – on the codex there’s a page about the tag which explains how to provide a callback function which overrides the outputted html.

    See the section ‘Comments Only With A Custom Comment Display’

    Ah, I see.

    Blimey, that looks complicated.

    Is it worth losing simplicity for threaded comments? And paginated pages too, I think?

    I wonder if there’s some simple code somewhere that would make the old comments loop do the same job?

    Yeah, I thought it looked complicated but the only complex thing is the mixing of php and html – I prefer to output all my html from php without breaking out. Once I got past this mental block, it’s not that bad!

    Actually, Otto’s comments (from the link above) demonstrate how it looks and it’s not so bad.

    By Viewing Source I can get a good idea of all the different classes, too. As you say Adamh there’s a mental block to get over. I think I’ll sleep on it 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘<?php wp_list_comments(); ?>’ is closed to new replies.