WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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!

share|improve this answer

This codex lists many functions for comments.

share|improve this answer
Thanks,I checked that.But I didn't found what I'm searching for. – Yasir Adnan Dec 9 '11 at 4:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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