Support » Your WordPress » comments link

  • hello, I’m after a little bit of help but I can’t seem to find the answer in the forums.

    If someone goes to my site they will see the comments link at the bottom of each post, but it you go direct to a permalink no comments post link appears.

    I’m sure it’s just a line missing from a template but I can’t seem to work out what goes where.

    any help would be appriciated.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hey,

    Looks like you might be missing the line <?php comments_template(); ?> (see here for a description) from the “post” template.


    thanks for your help, I don’t appear to have a ‘post’ template. I’m using WP 1.5.

    I can see the comments but the link in the permalinked page the link to the comments doesn’t appear.

    I’m going to cry.

    Because you’re using popup comments, I assume you need/want to put <?php comments_popup_link(); ?> somewhere… that would make a similar link as on the main page.

    Are you sure there isn’t a link to your “Post template” when you go to Presentation > Theme editor? Do you have only “Main template”?
    Btw, “Post template” is the file called single.php (in a theme directory).

    ahhh, I think I might have some problems here. I only have a main template.php in the edit files list.

    I converted my old theme to a new one, but I don’t have a single.php file in my theme folder. I have comments.php, comments-popup.php, index.php and style.css.

    Nah, that’s no problem.

    Do you want the link to the popup comment OR the comments + form embedded under the post (when viewing just one post)?

    If you want the embedded form+comments, look near “Sorry, no posts matched your criteria”, end of the “post” div, after “feedback” div (those are all the same place 🙂 ). There should be a <?php comment_template(); ?> there. As rwatkins is suspecting, it might be missing.

    Now, if you want a popup link, it apparently requires some core code tweaking: I found this thread. See if there’s something that could help you. I peeked into the mentioned function file (that you should edit) and it is still a current issue.

    I understand, but in which file do i edit? Sorry I’m a bit dim. 😉

    to clarify:

    the main page of the blog shows a link to the popup comments beneith each post. If I go to the permalink url the post shows on it’s own but without the embedded comments and post comments form.

    I have the following files in my theme folder: comments.php, comments-popup.php, index.php and style.css.

    so i need to add <?php comment_template(); ?> into a file somewhere, but I have no clue which file to add it to.

    p.s thanks for your help so far – you are very helpful people.


    You need to add <?php comments_template(); ?> (note the s) into a file – you are correct :). However you can either add it to your index.php (main template) or create a single.php (the post template) which is used when a single post is displayed.

    To add to your index.php, follow the below. However…I’m not sure if it still works. I think it does, but if it doesn’t…have a go at what I detail underneath this!

    Inside your index.php (the “main template”) and after your post content (i.e. where you print out the post text, the number of comments, date and time, stuff like that), add in the comments_template() tag. When you are viewing a single post, WordPress will include the comments list and form; when you are viewing multiple posts (like you do on the front page of your site) it isn’t included.

    If this doesn’t work then you will have to create your own single.php template. See below for my guide on how to do this.

    To create your own single.php (the post template):

    Create a *new* file, called “single.php” inside your theme directory. This is the template used when you are viewing a single post (and therefore the one you want comments on). You can pretty much copy your “index.php” into this file, as that’s the layout you want the page to have.

    After you have done this, on the part of the page where you want the comments to be displayed, you need to add <?php comments_template(); ?> – this will display the comments form and list as defined in “comments.php”. Normally you’d have this after the post and so after the post-specific stuff (like where you have the template tag the_content()) you would add the comments_template tag.

    There are a few differences between the single.php and index.php templates – mainly that the index.php displays a list of posts whereas single.php lists just a single one. Have a look at the default template’s “single.php” for how you modify the main loop, but for mine the only difference is thus:

    The main template (index.php) has a loop of <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    post content here
    <?php endforeach; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>

    The single page template (single.php) has a loop of <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    post content here
    <?php comments_template(); ?>
    <?php endwhile; endif; ?>

    “Post content here” is probably the same for both – i’ve add in where I have my comments_template() call too.



    thank you so much for this rob, I’ll have a go later on after work. cheers.


    How did it go?

    It seems that The Loop I posted for “index.php” is the old one (from WordPress 1.2). It still seems to work (it was what I was using!) but in actual fact the loop syntax is the same for both single.php and index.php:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    post content here
    (maybe your comments_template() call here!)
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>



    I’m at a loss with this, I don’t even seem to have any loop text in my index.php and I couldn’t manage to create a single.php that worked.

    I’ve put a copy of the index.txt here ( to see if this can give anyone a clue as to where I’m going wrong. I’d realy appriciate some more help with this one please guys.


Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘comments link’ is closed to new replies.