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'm using this script to not show title on a specific page

<?php if (get_the_ID() != 50){ ?>

Now I need to add another page:

<?php if ((get_the_ID() != 50) || (get_the_ID() != 317)){ ?>

But it's not working.

share|improve this question

closed as off-topic by gmazzap, s_ha_dum, toscho Dec 14 '13 at 2:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions should be specific to WordPress within defined scope (merely happening in its context, such as generic PHP/JS/HTML/CSS, is insufficient). Might be better asked at Stack Overflow or other appropriate site of Stack Exchange network." – s_ha_dum, toscho
If this question can be reworded to fit the rules in the help center, please edit the question.

Try -

<?php if ((get_the_ID() != 50) && (get_the_ID() != 317)){ ?>

It should be AND not OR for this compare.

share|improve this answer
To add some detail to Shazzad's answer: Because you're using || (OR) isntead of && (AND), the conditional you have set up is TRUE if 'get_the_ID' is not 50 and also if it's not 317. Since 50 != 317, any value at all — including 50 and 317 — will return true. – Griffin Dec 13 '13 at 18:43

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