[resolved] Link to comments (4 posts)

  1. geekjon
    Posted 8 years ago #


    I would like to modify my theme so that on the main index page, below the post, where it says '1 comment', '2 comments', etc. so that those would link to the comments.


    2 comments --> links to <a title="comments" name="comments"></a>

    If someone could show me what php functions to add, I would appreciate it.

  2. Kafkaesqui

    Posted 8 years ago #

    comments_popup_link() should already display the anchor fragment '#comments' as part of the link when there are comments on a post. You'll just need to make sure

    <a title="comments" name="comments"></a>

    appears in your theme's comments.php template (assumedly before the comments start to display), or in the single.php template right before:

    <?php comments_template(); ?>

  3. geekjon
    Posted 8 years ago #

    I have already put the anchor before the comments. The problem that I need help with is taking the following snippet of code (from my index.php) and put hyperlinks to the comments for that post:

    <p class="info">by <?php the_author(); ?> <span>|</span> <?php comments_number('No Comments','1 Comment','% Comments' );?> <span>|</span> Tags: <?php the_category(', ') ?> <?php edit_post_link('| Edit','',''); ?></p>

  4. geekjon
    Posted 8 years ago #

    Okay, I just checked comments_popup_link() and that looks like it'll do the trick. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic