conditional - How to display a unique header image to blog category and subcategory in Wordpress -


i using following code display specific header graphic depending on page or category viewer on:

<!-- custom design masthead --> <?php if ( is_page(259) ) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/masthead-1.jpg" width="1140" height="250" alt="custom acrylic furniture" />  <!-- , sub-pages masthead --> <?php } elseif ( is_page(array(245,348,352,357,325)) ) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/masthead-2.jpg" width="1140" height="250" alt="custom acrylic furniture" />  <!-- design community masthead --> <?php } elseif ( is_page(array(365,568)) ) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/masthead-3.jpg" width="1140" height="250" alt="custom acrylic furniture" />  <!-- contact , privacy masthead --> <?php } elseif ( is_page(array(264,330)) ) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/masthead-4.jpg" width="1140" height="250" alt="custom acrylic furniture" />  <!-- blog masthead --> <?php } elseif ( is_category(4) ) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/masthead-5.jpg" width="1140" height="250" alt="custom acrylic furniture" />  <?php } else { ?> <?php bloginfo('template_directory'); ?>/images/masthead-0.jpg" width="1140" height="250" alt="custom acrylic furniture" />  <?php }?> 

so far, good. problem running how modify following statement:

<!-- blog masthead --> <?php } elseif ( is_category(4) ) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/masthead-5.jpg" width="1140" height="250" alt="custom acrylic furniture" /> 

so includes category , subcategories.

any appreciated!

you need subcategories of current category $this_cat = (get_query_var('cat')) ? get_query_var('cat') : 1; wp_list_categories('child_of=' . $this_cat . '');

after need apply conditions.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -