Part 5: comments.php

This is the file that gives you the comments and the comment form. In this file there are a few codes that I don’t know to explain what they do. All I know is that they must not be deleted. So, first this is the overall file: comments.txt

Section 1:
Here is a code that must not be deleted. Here are probably some functions for the comments and the comment form. I guess

Section 2:
This is a function that will get your comments if there are any, of course. Do not change this.

Section 3:
This is where a comment starts. You can see that I added some divs there to customize the background of the date and time section of the comment. I pointed them in the document too. After that, we have the time and date the comment was posted. This is the code:

Posted on <?php comment_date(‘F jS, Y’) ?>, at <?php comment_time() ?>

You can modify the writing outside the code. This will get you the date and the time.

I opened a different div for the comment text. This will give the comment a different background that the date and time section.
First I put the gravatar. I have another div to give the gravatar a background, and after that the actual code for the gravatar starts:

<?php echo get_avatar( $comment, $size = ‘120’, $default = ‘’);?>
<br /><a href=”<?php comment_author_url(); ?>” > <?php comment_author(); ?></a>

The first line of code is the actual gravatar. You can change there the size (modify 120) and the avatar link (you have to put the entire link of the gravatar, it doesn’t work other way. Also make sure your gravatar size matches with the size of the actual gravatar.
The second line stands for the comment author. You shouldn’t modify it.

After that I am closing the div for the gravatar, and there comes the code for getting the actual comment:

<?php comment_text() ?>

Section 5
This is a code for alternative background comments. You should modify the css to get that.

Section 6
Here are some functions that will run when you don;t have any comments. Don’t modify these.

Section 7
Here starts the leave a comment section. First I am putting a title there. I am starting with a div for the background, the same as for the comment, and after that I am adding a title using <h3> tags.

Section 8
These are some functions for getting the comment form, authorizing posting a comment and so on. Leave this unmodified.

Section 9
This include section 9, 10, 11, 12, 13, 14
This is the actual comment form. You can see in the file what every section means. I put my form in a table to organize the fields for name, email, website on the left and the comment field on the right. Just take a look. You can leave it unmodified or you can create some style codes for organizing this section.

Section 15
Here are some codes for the comment form functions. Don’t modify these. Also, it include the close div for the “commtext” tag opened in section 7 (for the leave a comment area background) and the div that will close you content div opened in header.php

This is what I think you should know about this file. I hope now you can figure out where you can modify things and where you cannot.