The link created by the comments_popup_link function adds #comments to the end of the permalink. On a post with comments, the anchor id is “comments” so it jumps to that anchor and works perfectly…
However, on a post without comments, the anchor id is “respond” and it doesn’t jump to the comments area. How would I modify the function to add #respond to the permalink if no comments exist, but use #comments as the anchor tag if comments exist?
Here’s what I’m talking about. You can see the issue by clicking links with or without comments, and the resulting jump to anchor or lack-of jump to anchor.
- The topic ‘changing anchor id depending on number of comments’ is closed to new replies.