if/else problem
-
I just figured out how to create a different sidebar for individual pages using the if/else tag. While it works if I use the tag for one page I can’t figure out how to set multiple if/else tags. For example I ahve a seperate sidear for each of the pages I have. My current coding looks like this:
<?php if ( is_page(‘Biography’) ) { ?>
<?php include (‘sidebar1.php’); ?><?php } else { ?>
<?php get_sidebar(); ?>
<?php } ?><?php if ( is_page(‘8, 9, 11, 12’) ) { ?>
<?php include (‘sidebar2.php’); ?><?php } else { ?>
<?php get_sidebar(); ?><?php } ?>
<?php if ( is_page(‘Linkage’) ) { ?>
<?php include (‘sidebar3.php’); ?><?php } else { ?>
<?php get_sidebar(); ?><?php } ?>
<?php if ( is_page(’17, 18′) ) { ?>
<?php include (‘sidebar4.php’); ?>
<?php } else { ?>
<?php get_sidebar(); ?><?php } ?>
Obviously this si incorrect as the pages either show the default sidebar or the deafulat sidebar and an eeror parse message. How am I supposed ot code this? Do I only list one else tag or is there another way to code it. This might be confusing so just ask for me to explain agai if needed ??
- The topic ‘if/else problem’ is closed to new replies.