• Can anyone help me edit my twenty ten child theme so that featured images display as the header for all posts?

    thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • edit loop.php (about in the last quarter):

    <?php else : ?>
    		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    			<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>

    possibly replace:
    <?php the_title(); ?>
    with:
    <?php the_post_thumbnail(); ?>
    or check for the thumbnail first with the title as fallback:
    <?php if( has_post_thumbnail() ) { the_post_thumbnail(); } else { the_title(); } ?>

    for ‘post_thumbnail’ size parameters see http://codex.wordpress.org/Function_Reference/the_post_thumbnail
    http://codex.wordpress.org/Post_Thumbnails

    Thread Starter jampen26

    (@jampen26)

    No, that doesn’t work – your code above simply replaces the title with the featured image.

    I would like the main page of the blog to display normally (with the title at the top), however, if someone click on the page for a paritcular post I would like the header in my twenty ten theme to display the featured image (with the title displaying as per normal.

    thanks!

    if someone click on the page for a paritcular post I would like the header in my twenty ten theme to display the featured image

    the theme should do this automatically if the featured image in a post (or static page) matches the minimun header image size; 940px in the unedited theme.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display featured image as header on posts?’ is closed to new replies.