Created
June 23, 2013 18:35
-
-
Save psflannery/5846007 to your computer and use it in GitHub Desktop.
Sets the thumbnail image as background to a div
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<header class="entry-header row" <?php | |
if ( $thumbnail_id = get_post_thumbnail_id() ) { | |
if ( $image_src = wp_get_attachment_image_src( $thumbnail_id, 'x-large-size' ) ) | |
printf( ' style="background-image: url(%s);"', $image_src[0] ); | |
} | |
?>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' ); | |
$image = $image[0]; ?> | |
<div id="primary" class="content-area fader" style="background-image: url('<?php echo $image; ?>');"> | |
<div id="content" class="site-content" role="main"> | |
<?php get_template_part( 'content', 'home' ); ?> | |
</div><!-- #content --> | |
</div><!-- #primary --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment