WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

closed as off topic by Michael, anu, Rarst Aug 8 '12 at 13:57

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This isn't a WordPress question - should be moved over to SO. – anu Aug 8 '12 at 12:23
You're missing a set of parenthesis from your is_single call. – Joseph Leedy Aug 8 '12 at 13:54
up vote 0 down vote accepted

try this

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

Think your 'not' ! is causing the issue. btw, you could move it to this

<?php if ( !( is_page_template('modelPages.php') || is_archive() || is_single() ) ) { ?>
share|improve this answer
Thank you - that worked great1 – V Neal Aug 8 '12 at 10:02
you are welcome – woony Aug 8 '12 at 11:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.