Support » Themes and Templates » comments_popup_link() change hash to #c?

  • hey guys, the comment_popup_link links to the permalink with a #comment hash at the end!

    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    Is it possible to overwrite that behaviour to just have “#c” at the end so it’s shorter?

    thank you

    ps: the same would be interesing for

    <?php cancel_comment_reply_link(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael


    Forum Moderator

    what is the big idea behind this?

    probably quite difficult to achieve:

    there is no filter hook available to do this.
    this #comments is hardcoded in /wp-includes/comment-template.php:

    518      function get_comments_link($post_id = 0) {
     519      return get_permalink($post_id) . '#comments';
     520  }

    it also corresponds to the anchor with the same id in comment_form() (? not quite sure)

    ‘cancel_comment_reply_link()’ does have a filter hook: ‘cancel_comment_reply_link’ which you could use to change #respond.

    again, #respond corresponds to an anchor id in comment_form()

    thank you, i just thought there might be a way to change that so it’s shorter. Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘comments_popup_link() change hash to #c?’ is closed to new replies.