Condense PHP (3 posts)

  1. Doobus
    Posted 8 years ago #

    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.

  2. fitztrev
    Posted 8 years ago #

    <?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.

  3. Doobus
    Posted 8 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.