Based on your comment:
I am not trying to detect when I am on a single page but I want to have custom single.php pages like the wp codex says I can by doing single-post_format.php so that I can be able to have control of what you see on the single page for the different post formats(getting rid of the view commenmts link)
The template hierarchy doesn’t account for the post format taxonomy with respect to single blog post pages, which have a hierarchy of:
single-$posttype.php
single.php
index.php
All posts that have the post format taxonomy have a $posttype
of post
. You could use single-post.php
, but that really wouldn’t help you in this case. You’ll want to modify one/all of content-image.php
, content-video.php
, content-gallery.php
, and comments.php
.
Based on this comment:
Would I have to take
<div class="post-comments"> <p class="postcoments"><a href="https://wordpress.stackexchange.com/questions/72462/<?php comments_link(); ?>"> View responses</p> </div> --></a> </div>
out of mycontent.php
and other format type files and stick this in theindex.php
in between the loop code?
No, not really. I would recommend just wrapping that code in an if ( is_single() )
conditional:
<?php if ( is_single() ) { ?>
<div class="post-comments"> <p class="postcoments"><a href="https://wordpress.stackexchange.com/questions/72462/<?php comments_link(); ?>"> View responses</p> </div> --></a> </div>
<?php } ?>
That way, the “View Comments” code is not output on single blog post pages, but if the same content-$format.php
is used to output Loop content on index.php
(for the blog posts index, archive index pages, etc.), the “View Comments” code would still be rendered.