WordPress.org

Support

Support » Themes and Templates » [Resolved] Link to comments

[Resolved] Link to comments

  • geekjon

    @geekjon

    Hi,

    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.

    Example:

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

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kafkaesqui

    @kafkaesqui

    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(); ?>

    geekjon

    @geekjon

    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>

    geekjon

    @geekjon

    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 ‘[Resolved] Link to comments’ is closed to new replies.
Skip to toolbar