PitaMaria
asked on
Conditional in Wordpress child theme
My site is at http://www.aurorahealthaccess.org -- it's built on a child theme for Twenty Ten. I've got some conditions set for how div#branding area is served up, and it's working properly on all traditional pages but not on any single/singular/post/blog pages. Basically I want those post pages to behave just like any other page (except is_front_page because its div#content is handled differently). My template code is below.
I think it's as easy as adding another condition to the code in line 5 but I can't seem to figure it out. Any help would be much appreciated. Thanks in advance.
I think it's as easy as adding another condition to the code in line 5 but I can't seem to figure it out. Any help would be much appreciated. Thanks in advance.
<?php
get_header(); ?>
<div id="container">
<?php if ( !is_front_page() ) { ?>
<div id="branding" role="banner">
<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
<<?php echo $heading_tag; ?> id="site-title">
<span>
<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
</span>
</<?php echo $heading_tag; ?>>
<div id="site-description"><?php bloginfo( 'description' ); ?></div>
<?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 : ?>
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; ?>
</div><!-- #branding -->
<?php } ?>
ASKER
@gwkg: That worked for all single post entries -- thanks for that -- but not for author, category, comments, tag or posts pages. I thought single.php covered those pages, no? Do I need to save child versions of each of those too?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I ended up figuring it out. Thanks for the help, @gwkg.
Since you are using a child theme, if you do not create a new single.php file, your theme is using the one from twentyten.
If you weren't using a child theme and left out single.php, your theme would use index.php to display a single post page.