Support » Fixing WordPress » How can i know if the comment is the last comment of post?

  • I search a way IN THE LOOP to determine the last comment of a post, i search sth like comment(“last”)==true.
    I am not searching a way to get the comment id from the mysql DB, i just want to make an anchor for the last comment to jump to. but in a simple way, like archieve.php#lastcomment
    and not sth like #comment-178

    the ID doenst help me a lot there because i want to make it simple, no additional queries

Viewing 2 replies - 1 through 2 (of 2 total)
  • If you need to know a “spot” where the last comment is, then use the next style after it. In the single.php single post template for the Default Theme, the footer is the next element. Want a graphic or something there, then add it to the style of the footer.

    If you want something REALLY there, then put it there yourself like this. Between the last comment code in the single.php or index.php (whatever your theme uses), and before the footer.php include or get reference (I’ll include this as a reference point), add the following or something similar:

    <?php endif; ?>
    <div class="endcommentsplaceholder">Something here</div>
    <?php get_footer(); ?>

    Then add .endcommentsplaceholder (or something shorter and sweeter) to your style.css style sheet and add the styles for what you want that to look like. If it is a graphic then add background:url(graphic.jpg)... and so on.

    Thread Starter Seikilos


    I dont need an achor tot he footer, i need sth before the last comment, so i can jump to it, not to the footer or the leave-a-comment div

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can i know if the comment is the last comment of post?’ is closed to new replies.