• Resolved Jonas Grumby

    (@ss_minnow)


    I’m trying to get a client’s “Blog” page to display a different right sidebar than the rest of the pages. I entered this into the page.php file of the template:

    Where it used to say:

    <?php include ('sidebar2.php'); ?>

    I changed it to:

    <?php
      if (is_page("blog")) {
      echo '<?php include ('sidebar2.php'); ?>';
      } else {
       echo '<?php include ('sidebar3.php'); ?>';
      }
    ?>

    This code was taken directly from a site that it works on. All I changed is what is in the echo '' part and removed some elseif lines.

    Can anyone tell me why this isn’t working? I think it’s because I have <?php ?> in there more than once but don’t know how else to write it.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Jonas Grumby

    (@ss_minnow)

    Found the code by searching Google:

    <?php if ( is_page('blog') ) { ?>
    <?php include(TEMPLATEPATH.'/sidebar2.php');?>
    <?php } else { ?>
    <?php include(TEMPLATEPATH.'/sidebar3.php');?>
    <?php } ?>

    Thanks!

    edit – ha beat me to it

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

The topic ‘Conditional Tag code not working’ is closed to new replies.