Random headerimage for mother and childpages
-
Hi,
I would like to have a different headerimage for certain pages and all the childpages. The code below shows how you can set a particular image for a specific page, but I would also like to do this for all childpages.
div id="header_img"> <?php if (is_page('archives')) { ?> <img src="<?php bloginfo('template_url'); ?>/images/header_archives.jpg" width="790" height="140" alt="<?php bloginfo('name'); ?> archives page header image" /> <?php } elseif (is_page('about')) { ?> <img src="<?php bloginfo('template_url'); ?>/images/header_about.jpg" width="790" height="140" alt="<?php bloginfo('name'); ?> about page header image" /> <?php } else { ?> <img src="<?php bloginfo('template_url'); ?>/images/header_<?php echo(rand(1,5)); ?>.jpg" width="790" height="140" alt="<?php bloginfo('name'); ?> random header image" /> <?php } ?> </div>
Can some tell my how an image can be used for the childpages aswell? Many thanks, Sugar
- The topic ‘Random headerimage for mother and childpages’ is closed to new replies.