
csleh
By: a guest on
Oct 28th, 2010 | syntax:
None | size: 1.67 KB | hits: 149 | expires: Never
This is the if/else code I'm using to apply different headers to sections:
<?php
if ( is_page('about-us') || $post->post_parent == '6' ) {
// the page is "About", or the parent of the page is "About"
echo '<img src="' . get_bloginfo('template_directory') . '/images/1784461-penchart.png" />';
} elseif ( is_page('what-we-do') || $post->post_parent == '8' ) {
else {
}
?>
<?php if (is_front_page()) { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/detroit.png" alt="Detroit Michigan" />
<?php } else if (in_category('links')) { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/Arc.jpg" />
<?php } else { ?>
<!--creating a phantom image for some reason so this is commented out -->
<!-- <img src="<?php bloginfo('template_directory'); ?>/images/mu.jpg" /> -->
<?php } ?>
and this is the code from twenty ten header.php I'd like to modify to show different headers based on section, UNLESS a page has a featured image, in which case I'd like that to show.
<?php
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() &&
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, 'post-thumbnail' );
else : ?><!-- this is where I tried changing so there were defaults based on category, but the site kept breaking-->
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; ?>