I’d like a way to target only blog-area pages for specific formatting.

So far,

<?php if (is_home() || is_single() || is_category() || is_archive() ) { ?>

works okay, but is there a way to combine all of those into one single function to shorten it up a bit? so maybe in the functions it would set is_blog() to equal those four (or however many I want).

Seems a bit simple and probably is…. I just dont know what to search for to find information on this. Thanks!!

3 Answers
3

Based on what you described:

function is_blog()
{
    return ( is_home() || is_single() || is_category() || is_archive() );
}

And then just call the is_blog() function whenever needed.

I also found this, which looks like a more specific way to do the same thing https://gist.github.com/1189639

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *