Having problems with is_page() tag (3 posts)

  1. peiqinglong
    Posted 10 years ago #

    So I'm using TinyMCE throughout my site for comments on posts and pages, but I'm also blocking it from activating on 1 specific page such contact-us. I believe I have the conditional tags correctly to exclude the contact-us page, but instead it excludes all pages. For example, in my header, I have this:

    <?php if (is_home() | is_page('exclude=13') | is_single() | is_archive() | is_category())
    { then the code } ?>

    So it produces the effect I like on: http://www.bui4ever.com/contact-us/, but on other pages, it should show the TinyMCE, but it doesn't: http://www.bui4ever.com/testonly. So I'm not sure what is wrong? I want the TinyMCE to appear on all pages but not on the contact-us page. Thanks!

  2. is_page doesn't have an exclusion capability. What that code is doing is checking for a page with the name "exclude=13".

    You can do what you really want like this:
    <?php if (is_home() || (is_page() && !is_page('Contact Us')) || is_single() || is_archive() || is_category())
    { then the code } ?>

    That checks for both it being a page and NOT being the "Contact Us" page. If you really wanted to specify by ID, you could also use !is_page(13), I think.

    Notice that I doubled all your or's too. That's the right way to do that sort of thing.

  3. peiqinglong
    Posted 10 years ago #

    Ahhh that worked perfectly! Thank you! Still a bit new to the whole conditional tag thing and this is a big eye opener! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.