Support » Themes and Templates » If Page Id is x insert image

  • Hello all,

    I have figured out how to add an image to my header area using the following code;

    <?php if (is_home()) { ?>
       <image src="<?php bloginfo('stylesheet_directory'); ?>/images/all_round_yoga_home.jpg" />
    <?php } elseif (is_page(8)) { ?>
       <image src="<?php bloginfo('stylesheet_directory'); ?>/images/all_round_yoga_therapy.jpg" /><?php } ?>

    My problem is I also need to add an image to the same area of my site for each of the six categories but I cannot figure this out.

    Page with Image: http://www.allroundyoga.ie/wip/reiki/
    Category Archive with no image: http://www.allroundyoga.ie/wip/category/yoga-for-breathing/

    As you can see on the category & post pages there are no images.

    Any help would be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Just figured it out if anyone is interested in the future …

    <?php if (is_home()) { ?>
       <image src="<?php bloginfo('stylesheet_directory'); ?>/images/imagename.jpg" />
    <?php } elseif (is_page(8)) { ?>
       <image src="<?php bloginfo('stylesheet_directory'); ?>/images/imagename.jpg" />
    <?php } elseif (in_category( '5' )) { ?>
       <image src="<?php bloginfo('stylesheet_directory'); ?>/images/imagename.jpg" />
    <?php } ?>

    Thanks, this works a treat!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If Page Id is x insert image’ is closed to new replies.