Get a conditional to change image on header.
-
Hi, I’m trying to get a conditional to change the header image, I’m using Yoko Template and I’m not an expert on PHP, here’s what I’ve got so far.
if ( is_singular () && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && $image[1] >= HEADER_IMAGE_WIDTH ) : // Houston, we have a new header image! echo get_the_post_thumbnail( $post->ID , array(1102,350), array('class' => 'headerimage')); elseif ( (get_post_image) ) : ?> <img src="<?php header_image(); ?>" class="headerimage" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" /><!-- end headerimage --> <?php endif; ?>in the line
elseif ( (get_post_image) ) : ?>I substituted get post image for “null” and I got the template to just show me the header image on the home page, what I want now is to get the conditional to show me another image for the rest of the posts, with reduced height to make it navigation-wise friendlier.
Thanks in Advance.
The topic ‘Get a conditional to change image on header.’ is closed to new replies.