Support » Plugins » How Can Title Be Blocked on Specific Pages

  • I can get the title NOT to post for one page ID, but having trouble on the code for more than one page ID.

    This is the IF code that works for one page: if ((!is_page(’35’))

    This is the IF code I used for 2 pages, but it does not work:
    if ((!is_page(’35’)) || (!is_page(‘108’)))

    What am I doing wrong?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Try

    if ((!is_page('35')) && (!is_page('108')))

    Thread Starter Storyman

    (@storyman)

    Michael,

    Thank you. That works.

    I don’t understand why the logic Operator AND is used instead of OR. Shouldn’t I be testing against one or the other argument?

    Welcome to the ‘I don’t get that’ club!

    It’s something to do with two NOTs require an AND…but I can’t really explain it other than it’s a rule to memorize 😉

    Maybe a programmer (or logical person) will stop by and expand….

    Don’t worry, I have dreams about PHP, and I get confused around those sorts of things too. Happens to everyone.

    Well I thought about this over breakfast and I might understand…

    When using OR, only one of the conditions has to be true, and because the first condition is true it doesn’t bother to test the 2nd condition.

    So if the page is 108, then the first condition is met (not equal to 35) and it never tests the NOT EQUAL TO 108 portion.

    U R Right Michael and may i add this (without being a programmer):

    OR here means:
    Either the first condition is NOT true || the second condition is NOT true

    AND here means:
    If first condition is NOT true && second condition is also NOT true

    Just thoughts before lunch 😉

    Thread Starter Storyman

    (@storyman)

    Thanks Everyone,

    This has been informative and quite helpful and gives me a better understanding of PHP quirks (probably it is my logic that is quirky and not PHP’s).

    It’s not a quirk of PHP. It’s actually the way pretty much all programming languages (at least all the important ones — LOLCODE doesn’t count) work.

    Once you learn that logic, you can apply it to whatever programming language you choose later on.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How Can Title Be Blocked on Specific Pages’ is closed to new replies.