WordPress.org

Ready to get started?Download WordPress

Forums

Excluding Content using is_page (3 posts)

  1. jrothra
    Member
    Posted 3 years ago #

    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>
    </div>
        	<?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: http://www.jrothraministries.com

  2. 123milliseconds
    Member
    Posted 3 years ago #

    >>

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

    replace || with &

    Page must not be 911 and not 142 and not 163

  3. keesiemeijer
    moderator
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.