Support » Plugins » Modify PHP to exclude widgets on certain pages?

  • My template has bottom.php which is used for the display of three columns of widgets. I have several pages that I don’t want to display the three columns of widgets at the bottom of the page. The code in the Main Index Template that calls the bottom.php is this:

    <?php endif; ?>
    <?php include (TEMPLATEPATH . "/bottom.php"); ?>

    The following is on the header.php file for displaying the slideshow on the front page only. Can this be adapted to allow everything but two pages or exclude two pages but allow everything else?

    <?php /* If this is home */ if (is_front_page()) { ?>
    <?php include (TEMPLATEPATH . '/slideshow.php'); ?>
    <?php } ?>

    <?php if ( $paged > 1 ) { ?>
    <?php } ?>

    Any help is appreciated.

Viewing 1 replies (of 1 total)
  • You should be able to make use of the is_page() conditional, here is a link to the codex page:

    Look at something along the lines of:

      if (is_page(array(42,'about-me','Contact')))
        include (TEMPLATEPATH . "/bottom.php");

    So, when the page displayed is either post ID 42, or post_name “about-me”, or post_title “Contact” the bottom.php file will be included.

    You can also use ‘!is_page()’ to not include bottom.php as well.

Viewing 1 replies (of 1 total)
  • The topic ‘Modify PHP to exclude widgets on certain pages?’ is closed to new replies.