• Resolved puremood

    (@puremood)


    I just put up a new theme. It has pop-up comments on it (that’s how the theme was made). This is my first time using popup comments.

    I added a comments.php page (as it didn’t have one, only one for pop ups) to show/allow comments on my pages. (i.e. if you look at the “About” page, “100things”, etc. comments are there -where as they wasn’t till I added the comments page and called the function)

    What I would like to do (and not sure how) is add comments to each “post” page. I’m not sure why it doesn’t appear when I have comments on other “pages”. I don’t care if they are pop up or on the same page – I just want to make it more “user friendly” by having the option appear.

    For example – If you visit my main page https://justpuremood.com you see a comment link for each post. However, when you click the title or visit the post from the permanent link such as https://justpuremood.com/?p=487 there is no way to leave a comment without going to the main page. I’d like to add comment there just like they appear from the main page.

    If anyone can help, I’d appreciate it. Hope this wasn’t confusing.

    TIA
    -PM

Viewing 2 replies - 1 through 2 (of 2 total)
  • If you want comments–and the comment form–to appear on single post pages, add this to your theme’s single.php template where comments should appear:

    <?php comments_template(); ?>

    If your theme doesn’t have a single.php, use this in the theme’s index.php:

    <?php
    if(is_single()) :
    comments_template();
    endif;
    ?>

    If you only want a link to your popup comments, we need to construct it since comments_popup_link() will not display on single post pages.

    For link text we can duplicate the format of the regular comments link by using comments_number():

    <?php comments_number('No comments', '1 comment', '% comments'); ?>

    This displays as plain text, and works on single post pages. For the link url, we’ll manually pull the elements together (specifically for your site):

    <?php bloginfo('home'); ?>/?comments_popup=<?php the_ID(); ?>

    And bringing the two together as a link:

    <a href="<?php bloginfo('home'); ?>/?comments_popup=<?php the_ID(); ?>"><?php comments_number('No comments', '1 comment', '% comments'); ?></a>

    Again, this goes in single.php, or lacking that in your theme’s index.php using an if(is_single()) statement:

    <?php if(is_single()) : ?>
    <a href="<?php bloginfo('home'); ?>/?comments_popup=<?php the_ID(); ?>"><?php comments_number('No comments', '1 comment', '% comments'); ?></a>
    <?php endif; ?>

    Thread Starter puremood

    (@puremood)

    Awesome. Thanks SO much… It doesn’t have the single.php so thanks for the details & such.

    I got it working now, like I want. Yippie! Appreciate it so much!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding comments link on post page’ is closed to new replies.