Only Display Comments When Viewing Comments URL
-
Hi All,
I’m trying to clean up my single posts by only displaying the comments for a particular post when the user clicks on the “view comments” url. I’ve created a child theme and have my own custom code to display the post title, content, etc. and I’m inserting a link to the comments page using the comments_link() function.
What I’m unclear on, and struggling with, is I think I need some kind of conditional statement in my single.php so that if the “/#comments” which is appended to the URL is there, then I display the comment template, and if its not, then I display a link to the comments URL.
I’ve been trying to google this for quite a while, but I’m not having any luck.
Is there some kind of flag or variable I can read to determine if the user has clicked on the comments URL? If I can figure that out, then a simple conditional statement to display or not display the comments is all I need, but I can’t figure out how to do this.
Any help is appreciated. Thanks.
- The topic ‘Only Display Comments When Viewing Comments URL’ is closed to new replies.