WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Bringing back my trackbacks...custom comment cb (6 posts)

  1. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    OK, I'm slowly working on the little things with my theme.

    I redid my comments a while back, and I guess I don't totally understand what I've done? :/ (no surprise)

    What I've got going on is all well and good, I like the results. I was going through a tutorial on separating my trackbacks from my comments.... however what I've got now doesn't even display trackbacks. It does include them in the count.. like on a post with no comments and 3 trackbacks, it will say 3 comments, but show nothing.

    I'll just post this up here in case someone feels frisky and wants to take a look, maybe at least help me understand a bit.... what have I got going on here that doesn't display trackbacks?

    How would I get them back? (Bonus points for helping me separate the trackbacks from the comments, but if I can understand what's what here, maybe I can work through the reste)

    Here's all the code, comments.php on top, functions.php on bottom
    http://wordpress.pastebin.com/0iVpJaRB

    Thanks folks!

  2. Mark / t31os
    Moderator
    Posted 3 years ago #

    Line 19
    wp_list_comments('type=comment&callback=advanced_comment')

    The type is setting the type of comments to fetch.

    There's a function for seperating the comments by type..
    http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/comment.php#L633

    However, there's also the second parameter in comments_template().
    http://codex.wordpress.org/Function_Reference/comments_template

    I've not tried to seperate comment types before myself.. just thought i'd point toward those two functions as possible areas of interest... :)

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Thanks much!

    I have no idea how I missed that, cuz I've been through the codex a few times...but there it is...explained clear as day!

    Thanks for pointing that out, gives me something to work with!

  4. Mark / t31os
    Moderator
    Posted 3 years ago #

    Of course it might just be easier to do something like..

    <ul>
        <?php wp_list_comments('type=comment'); ?>
        <?php wp_list_comments('type=pingback'); ?>
    </ul>

    Never tried it, but i'd consider that a simple method.. you could even have different callbacks for each different type (in theory - again not tried it).

    Always happy to help though... ;)

  5. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Yup, everything was pretty much ready to go to separate things... I just had to repeat the lising with the pings type like so:

    <ol class="commentlist">
    		<?php wp_list_comments('type=comment&callback=advanced_comment'); //this is the important part that ensures we call our custom comment layout defined above
                    ?>
    	</ol>
    <h3 class="commentTitle">Trackbacks and Pingbacks</h3>
    <ol class="commentlist">
    		<?php wp_list_comments('type=pings&callback=advanced_comment'); //this is the important part that ensures we call our custom comment layout defined above
                    ?>
    	</ol>

    Works perfectly..... I'm having a 'thick' week.... I seriously looked over that bit of code, and the wp_list_comments codex page like ten times. As soon as you nudges me, I had it all sorted in about 2 minutes!

  6. Mark / t31os
    Moderator
    Posted 3 years ago #

    I must say, i definately do prefer seperated comment types myself, annoying reading a good blog's comments only to have to keep skipping over piles of trackbacks and pings in between.

    More nudges available on request ... :)

Topic Closed

This topic has been closed to new replies.

About this Topic