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

I'm searching for some site where I can find line by line explanation of an wp theme's code.
Because, I want to implement on my site just commenting area.
I don't need sidebar, gadgets, searching, archives... all the toys.
My page has everything I need, except commenting area, but I can't find which code lines stands after pressing "submit" button.
I tried to find such a simple template - without success.

share|improve this question
up vote 2 down vote accepted

The Twenty Eleven Theme has some decent code comments that explain what's happening.

Quick and dirty overview:

All comment functionality goes in comments.php. You include it into your template with the aptly named comments_template which does a lot of stuff (sets up the current commentor, ect) other than just including `comments.php

Your comments.php template might look something like this.

// Is the post password protected?  Maybe you want to deal with that.
    // show a message to the users about the password requirement.

    // `return` out of the file, don't show anything else

// display the comments if they exist
    // maybe a header or something here

    // wp_list_comments (http://codex.wordpress.org/Function_Reference/wp_list_comments) 
    // actually displays the comments -- it will just work if
    // you use it without any arguments

    // You can also specify a custom callback to display things:
    // wp_list_comments(array('callback' => 'your_comment_callback'));

// are comments open? display the comment form!
    // `comment_form` does all the work. You can customize it
    // with arguments and filters. Like wp_list_comments this
    // will just work.
    // http://codex.wordpress.org/Function_Reference/comment_form
    // display a message about comments being close for visitors
    // this optional -- personally, I prefer to show no message.

Take a look at the Twenty Eleven's comment callback for some real insight in ways that you can display comments themselves.

share|improve this answer
Thanks a lot, chrisguitarguy. I'll study your code and links, and hope this will be solved. – Alegro Dec 3 '12 at 5:40

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.