So I'm displaying 3 different layout types, one for pages, one for posts (blog, archives, tags, search etc..) and one for single posts.
Originally, I was using this to decide whether I was on a page which displayed posts:
if ( is_home() ||
is_category() ||
is_tag() ||
is_archive() ||
is_tax() ||
is_author() ||
is_date() ||
is_search() ||
is_attachment() ) :
It's not pretty, but it covers everything.
My question is, is this practically the same thing, but cleaner?
if ( ! is_page() && ! is_single() ) :
Does that cover everything in the first block of code? Am I missing something completely obvious that will cause this to not work as intended?
I think it does the same thing, but I wanted to bounce this off the community as well.
Thanks!
EDIT - here's what I have now:
// Set up the layout variable for pages
$layout = $generate_settings['layout_setting'];
// If we're on the single post page
if ( is_single() ) :
$layout = null;
$layout = $generate_settings['single_layout_setting'];
endif;
// If we're on the blog, archive, attachment etc..
if ( is_home() || is_archive() || is_search() || is_attachment() || is_tax() ) :
$layout = null;
$layout = $generate_settings['blog_layout_setting'];
endif;
// Finally, return the layout
return apply_filters( 'generate_sidebar_layout', $layout );
Seems to work perfectly, and is cleaner than my original group of conditionals.
I couldn't find any proof that is_tax is taken care of by is_archive() - did I just miss it?
Thanks!