Support » Themes and Templates » Using a featured image as a header

  • Hi there I am in the process of developing a theme for my site based around the Pronto, I would very much like to have a featured story at the top that looks like the Top Story section on ReadWrite.

    I have managed to create a featured section at the top of my site using this code, which works very well”

    <div id="featured"> <?php query_posts('posts_per_page=1&cat=2'); ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('jS F Y'); ?></small> <p><?php the_excerpt(); ?></p> <p> <a href="<?php the_permalink(); ?>">Read More >></a> </p> <?php endwhile; ?> <?php wp_reset_query(); ?>>
     </div>

    I am calling the featured image for the background using this code:

    <body <?php body_class(); ?>
    		<?php if($src !== '') { echo 'style="background:url( '. $src[0] . ' ) no-repeat center top; width:100%;" ';
    		 } else { echo 'style="background:url(images/default-bg.png) repeat-x;"'; } ?> >

    But the problem I am having is that I cannot find a way to scale the image to the full width of the page or the full height of the div.

    Please can someone help as this is driving me crazy.

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