• I have an issue with the comment link on the main page linking to a single comments page, rather than jumping to the comments section of the post.

    In other words, the comments load outside of the loop I guess?

    When following the blow link:
    http://example.com/category/post-title/#comments

    Comments are loaded on their own page, rather than jumping to the comments section with the post above.

    My question is, how can I make links from the homepage jump to the comments section of the post, rather than a single comments page?

    Thanks

Viewing 11 replies - 1 through 11 (of 11 total)
  • Do you see that little # in your link above?
    That means you need an anchor/target in your single post view (most likely in the comments.php template file) to get there.

    Thread Starter zpimpa

    (@zpimpa)

    Thank you moshu.

    When I view source on the page I see that the actual content of the post appears in the source, along with all sidebar links etc. However, the only thing that is displayed on the page is the comments.php page. Is that all because of the lack of an anchor?

    I don’t know and not seeing it I don’t want to guess.

    Thread Starter zpimpa

    (@zpimpa)

    Here is my index.php code

    <?php comments_popup_link('No Comments »', '[1]', '[%]', 'commentslink'); ?>

    Here is my single.php code

    <div class="commentsblock">
    		<a href="<?php comments_link(); ?>"><?php comments_template(); ?></a>
    	</div>

    Here is my comments.php code

    <h3 id="comments">Post a Reply</h3>

    Should the index ‘comments link’ be changed to the code below?

    <?php comments_link(); ?>">

    Code taken out of context doesn’t really help.
    The best would be:
    a) provide a link to see what’s going on
    b) post your trouble template files to http://wordpress.pastebin.ca so helpers can see them
    (and post back with the urls)

    Thread Starter zpimpa

    (@zpimpa)

    Thanks again. I cannot provide a specific link to the example because of the nature of the project.

    Anyways,

    index.php: http://wordpress.pastebin.ca/696104

    single.php: http://wordpress.pastebin.ca/696109

    comments.php: http://wordpress.pastebin.ca/696111

    So again, the problem is when clicking the comments URL from the index, only comments.php loads. However, the rest of the single.php code loads in the source (but is not displayed in the browser).

    single.php always shows only 1 (ONE) post. Why do you need a postcount code in it?

    IN the comments.php you have twice this ID:
    <h3 id="comments">
    Normally, that’s the place where the “comment link” should go from the index.

    Thread Starter zpimpa

    (@zpimpa)

    Thanks … I just noticed that this is only a firefox problem, that it works fine in Safari.

    Thread Starter zpimpa

    (@zpimpa)

    Does Safari treat anchors differently than Firefox for some reason?

    Thread Starter zpimpa

    (@zpimpa)

    bump …

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Issue with comments linking to single comments page.’ is closed to new replies.