PHP statement to check single post/page?

I tried <?php if (is_single()) { //something } ?> but to no avail.

I’ve got something going on with this snippet here:

<?php        
       if (is_home() || is_404()) {
       } else {
         get_template_part('templates/page', 'category-header');
       } 
     ?><!-- end of cat_title -->
    <!--  content -->
    <?php
      if (!is_404() || !is_page()) {
        get_template_part('templates/page', 'wide-col');
        get_template_part('templates/page', 'narrow-col');
      } else {
        get_template_part('404');
      }
      ?><!-- endofcontent -->

How do I check for single post/page? Thanks guys!

Please ask anything that isn’t Roots related on WordPress answers or stackoverflow. If you visit the codex page on is_single it will tell you the function you need to use.

1 Like

Ops sorry about that. Alrighty. Thanks!