Support » Fixing WordPress » Excluding Content using is_page

  • I’m able to exclude some content (social networking links) from one page, but not multiple pages. The code I use in the page template is:

    <?php if ( !is_page(911) ) : ?>
    <div style="padding-bottom:10px;">
    <?php edit_post_link('Edit', '<p>', '</p>'); ?><span class="st_twitter_large" displayText="Tweet"></span>
    <span class="st_facebook_large" displayText="Facebook"></span>
    <span class="st_digg_large" displayText="Digg"></span>
    <span class="st_gbuzz_large" displayText="Google Buzz"></span>
    <span class="st_email_large" displayText="Email"></span>
    <span class="st_sharethis_large" displayText="ShareThis"></span>
        	<?php endif; ?>

    That page doesn’t show the content listed, all others do. However, I want to also exclude these from eight other pages. I tried this code (only three shown here for example purposes):

    <?php if ( !is_page(911) || !is_page(142) || !is_page(163) ) : ?>

    When I did that, the content showed up on all pages including these three. I have more pages I want the social network links on than pages where I want them excluded. Any thoughts?

    My URL:

Viewing 2 replies - 1 through 2 (of 2 total)
  • >>

    <?php if ( !is_page(911) || !is_page(142) || !is_page(163) ) : ?>

    replace || with &

    Page must not be 911 and not 142 and not 163

    Moderator keesiemeijer



    try it with:
    <?php if ( !is_page('911') || !is_page('142') || !is_page('163') ) : ?>
    <?php if(!is_page(array('911','142','163'))) : ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excluding Content using is_page’ is closed to new replies.