Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 G. M., 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.

1 Answer 1

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.