• Tried searching for a solution but it was tough to know what words to use for the search. Hopefully I can explain it well.

    As we all know, after you read an article there is a link at the bottom you can click if you want to make a comment.

    There are two scenarios that happen when I click the link to leave a comment.

    (1) If no comment has been posted, after clicking the link, it starts at the top of the article and you have to scroll down to the comment box.

    (2) If a comment has already been posted, when you click the link, it goes right to the comment box.

    The second scenario makes more sense and I wanted to know how I could make that the case everytime. In other words, even when someone has not yet made a comment, I would like it when someone clicks the Comment Link at the end of an article, that it goes right to the comment box. I think it is confusing for the reader who wants to make a comment that when they click the comment link it takes them to to the start of the article instead of the comment box right after they have just read the article.

    Can someone please tell me how I can make the 2nd scenario be the case every time someone clicks the link to make a comment. In other words, when someone clicks the comment link, it goes right to the comment box for the reader to post their comment, even when a comment has not been posted yet.

    I’m using the Wp-Default AllSideBar Edition Template if that makes a difference in how to do this.

    Thanks for your help
    Steve

Viewing 2 replies - 1 through 2 (of 2 total)
  • I know I’ve replied on this issue before, but can’t seem to come up with the thread… Anyway, the problem is a bug in the default theme’s comments.php (which I unknowingly carried over into AllSidebar). The id attribute in the comments number header:

    <h3 id="comments"><?php comments_number...

    is the problem, in that this is only displayed when there is one or more comments on the post. Without it the fragment identifier (i.e. #comments) fails, and you only go to the top of the post’s page in your browser, instead of to the comment section.

    To fix, edit the comments.php template for the theme, and swap the following two lines:

    <?php if ($comments) : ?>
    <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>

    so it looks like:

    <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>
    <?php if ($comments) : ?>

    Note: Don’t copy and paste from here, or you’ll carry over some weird character elements. Just move the first line down one in the template.

    (And a note to everyone: This is changed in WP 2.0. There are different identifiers for whether there are comments (#comments) or not (#respond). AllSidebar will be updated to reflect this.)

    Thread Starter steveeyes

    (@steveeyes)

    Thanks Kafkaesqui. A quick and easy fix. I like that.

    Cheers
    Steve

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