WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] PHP operators - how to do something if it's not this OR this... (3 posts)

  1. vikkineal
    Member
    Posted 1 year ago #

    Can anyone advise what i'm doing wrong here?

    I'm trying to load a jQuery function IF the page isn't using a template OR if it's not a single OR if it's not an archive.

    I have the below...

    <?php if ( ! is_page_template('modelPages.php') || ! is_archive() || ! is_single ) { ?>

    But it doesn't seem to work... HOWEVER if I remove the or operators and subsequent rules, the function doesn't load (which is correct) on the modelPage.php templates.

    How should i be writing this rule?

    Thanks

    php

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    <?php if ( ! is_page_template('modelPages.php') && ! is_archive() && ! is_single() ) { ?>

    if it is none of those...

    btw: is_single was mising the brackets.

  3. vikkineal
    Member
    Posted 1 year ago #

    Ah I see! Thank you - that worked great.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags