WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Conditional Tags - small issue (3 posts)

  1. FECKcorp
    Member
    Posted 3 years ago #

    I am trying to display "THIS TEXT" on all pages that are not the homepage, a category index, or a single post. I tried the following code as recommended by WordPress' Codex but "THIS TEXT" is still showing up on all pages.

    <?php if (! is_home() || ! is_category() || ! is_single() ) {?>
    
    THIS TEXT
    
    <?php }?>

    Is there a special formatting for inputing is not (!) conditional tags? Or, better yet, what is wrong with the code above and how can I fix it?

    Thank you all very much!

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    try either:
    <?php if (! is_home() && ! is_category() && ! is_single() ) {?>
    or:
    <?php if (!( is_home() || is_category() || is_single() ) ) {?>

  3. FECKcorp
    Member
    Posted 3 years ago #

    ^ You, sir, are a genius.

    It works perfectly now. Much appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic