PHP: How to get “is visitor on comments page” ?
-
I am creating a template for myself and am having a little issue:
In index.php, I am displaying stuff like:
Category: bla | Comments (2)
Please note the pipe symbol (|).
I am using “the_category()” and “comments_popup_link()” for displaying both the cat and the comments link. But if a visitor clicks “Comments (2)” and the comments are being displayed, it is looking weird since there is a | after the category:
Category: bla |I want to remove this pipe if visitor is viewing comments.
So far I use:
<?php the_category(‘, ‘) ?> | <?php comments_popup_link(‘Comments (0)’, ‘Comments (1)’, ‘Comments (%)’); ?>How can I find out via PHP whether the comments are being displayed or not?
I’d like to have something like this:
if (is_visitor_on_comment_page) {
$isoncomment = true;
} else {
$isoncomment = false;
}
so that I can control what to display and so that I can hide this pipe symbol when visitor is on comment page.Checking comments_popup_link for true/false or for isempty() does not work.
Thanks in advance,
Michael
- The topic ‘PHP: How to get “is visitor on comments page” ?’ is closed to new replies.