The comment functionality
The last thing we need to do is add some comment functionality to our single post page:
- Let's go into
single.php
and go down. What we want to do is still within the panel body so that ends where it is shown. - Let's create a comment template and add
comments_template()
:
<?php endif; ?>
<?php comments_template(); ?>
</div>
- We'll save that and create a new file. We'll save it as
comments.php
.
That needs to be in your theme
folder, and then if we go ahead and type something in here, we'll say TEST
.
- If we save and reload, and you can see we're getting
TEST
:

Now let's create a div with a class of comments
and add <?php if(have_comments); ?>
.
- We also add heading
<h3>
with class ofcomments_title
. We will addif(get_comments_number() == 1)
. We are doing this because if there's only one comment then we should get comment singular, if there's more than one then it should say comments. - So we're checking to see if there's one comment, if there...