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


I have a following customized format for the website with Woocommerce.

  1. <?php if(is_shop()) {?> There are certain css styles, JS options used for this particular page
  2. <?php } if(is_front_page()) { ?> Same as above with different css animations used or certain classes when on home page of the site


Now, I want to use some specific jQuery options such as .Delay(), Hide(), & Show() on pages other than Shop & Home page

However, If I simply add the jQuery outside the options 1 & 2 mentioned above .. this gets applied to entire website -- overriding options specified for is_shop

I think if we can exclude pages then I can exclude these 2 pages above. Writing is_page (array) would be too tedious for hundreds of pages.

How can we exclude certain WP pages (in my case only 2)? Or should I re-format the page using if else & will it work?

Thanks in advance.

share|improve this question
up vote 1 down vote accepted

The opposite of is_page() will be ! is_page(). In php the ! is used as negative, so ! is_page( 42 ) will means something like

if we are not on page ID 42, do something, in other words exclude page ID 42

share|improve this answer
Thanks so much Pieter. That worked! Probably, I was under a different impression about using ! . I'm answering too. Cheers. – tushonline Jun 16 '14 at 9:32

Thanks Pieter, that solved the issue. I'm writing below some details just in case someone comes here in future.

As stated by Pieter in answer above, using !is_page is for excluding the page in opposite of using is_page for including functions for that page.

In my case, I noticed two things.

  1. <?php if(!is_shop() && (!is_front_page())) {?> I used the code needed everywhere else other than these 2 pages. Works great
  2. All the jQuery options needs to be common in all cases to work. We cannot ignore it in any of the cases. Which means, I had to mention jQuery options in all three cases to make it work as desired.

In my example: I had is_shop(), is_front_page() & !is_shop() where each of them needed this jQuery("#primary").delay($value) for it to work as desired on all pages.

Thanks all.

share|improve this answer
Thanks for sharing exactly what you did, and thanks for keeping this site constructive. +1 – Pieter Goosen Jun 16 '14 at 9:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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