• I apologize if this is in the wrong forum.

    I was looking through the conditional tags, and I was wondering if there was a way to condense the php for:

    <?php if (is_home()): ?>

    I would like to also put is_single in there, is there a way to do this without having to make one for single as well?

    I was under the impression that <?php if (is_home()): is_single(); ?> would work. Hopefully that gives you a better idea of what I’m trying to achieve. Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php if ( is_home() || is_single() ): ?> = “if this is the homepage of blog posts OR a single post…”

    Replace is_home() with is_front_page() if you’re using a page for a static homepage.

    Thread Starter Doobus

    (@doobus)

    Thanks I can’t stand to look at redundant code :P.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Condense PHP’ is closed to new replies.