Skip to content

Instantly share code, notes, and snippets.

<?php
$css = "style=''";
if ( has_post_thumbnail( get_the_ID ) ) :
$size = 'large'; // choose size of image to be used
$thumb_id = get_post_thumbnail_id();
$thumb_object = wp_get_attachment_image_src($thumb_id, $size, true);
$thumb_url = $thumb_object[0];
$css = "background-image:url('$thumb_url'); background-size:cover; background-position:top-center no-repeat;"
endif;
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(