Conditional tags: using "elseif" with images
-
Hi everyone,
I’ve searched through many forum posts on the subject, but still can’t seem to get this to work. I’m trying to have an image display differently on some pages. Here’s my code:<?php if (is_page(information)) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/information.png"> <?php } elseif (is_page(array(about-us,contact))) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/about.png"> <?php } elseif (is_page(array(products,coming-soon))) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/products.png"> <?php } else { ?> <img src="<?php bloginfo('template_directory'); ?>/images/default.png"> <?php } ?>
The first couple of images work fine (for the first “if” statement and “elseif” statement), but for the second “elseif” it doesn’t work. By the way, I am using the bloginfo(‘template_directory’) code to resolve an issue I had linking back to the source image folder. Any suggestions on getting these conditional statements to work?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Conditional tags: using "elseif" with images’ is closed to new replies.