Support » Themes and Templates » Link to comments

  • Resolved geekjon



    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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(); ?>

    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>

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

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