As we know we can usually make changes to "the content" by calling the_content(). is there any equivalent function available for comments? or any such way do you know?

2 Answers 2


I do hope I understand what you're asking, as you're not giving much information. From what I specifically to customize the output of your comments.

Well, there partially is. The wp_list_comments accepts a callback argument among several others. This callback allows you to run a custom function; in your case, a custom function to manipulate the comments' markup/output.

So, let's get started. Assuming your HTML structure looks somewhat like this:

<ul class="comments">
   <?php $args = array(
        'type'          => 'comment',
        'callback'        => custom_comments
   wp_list_comments($args); ?>

Then, you would create a function called *custom_comments*, that would look something like this: function custom_comments($args, $comment, $depth) { // your code.. // example from DigWP: http://pastie.org/2986583 }

Hope that helps!


This codex lists many functions for comments.

  • Thanks,I checked that.But I didn't found what I'm searching for.
    – Adnan
    Commented Dec 9, 2011 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.