Query based on whether posts have a featured image

Ever need to query for posts based whether they have a post thumbnail? This can be accomplished by adding 'meta_key' => '_thumbnail_id' to the query args:

<br />
&lt;?php<br />
$args = array(<br />
	'posts_per_page' =&gt; 1,<br />
	'meta_key' =&gt; '_thumbnail_id'<br />
);<br />
$my_query = new WP_Query( $args );</p>
<p>if ( $my_query-&gt;have_posts() ) : while ( $my_query-&gt;have_posts() ) : $my_query-&gt;the_post();<br />
...<br />

Easy way to check if jQuery is already enqueued

Had a plugin wreaking some havoc today because it was overloading jquery.js with a minified, older version. Plugin authors: There’s a really simple way to check if jQuery or a jQuery library is already registered and enqueued. This covers really obscure edge cases where a plugin may have de-registered WordPress’s default scripts.

The offending code:

<br />
wp_register_script('myjquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js', true, '1.6.4', false);<br />
wp_enqueue_script('myjquery');<br />

The fix:

<br />
// If jQuery isn't already enqueued, register and enqueue it<br />
if ( ! jQuery ) {<br />
	wp_register_script('myjquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', true, '1.7.2', false);<br />
	wp_enqueue_script('myjquery');<br />
}<br />