I'm using this code to display random images in my footer on post pages.
http://pastebin.com/Q9eKxfCG
It works, but not all of my posts have a thumbnail image. How can I make it only show posts that have a thumbnail?
Thanks for any help.
I'm using this code to display random images in my footer on post pages.
http://pastebin.com/Q9eKxfCG
It works, but not all of my posts have a thumbnail image. How can I make it only show posts that have a thumbnail?
Thanks for any help.
this seems to do the trick:
$args = array( 'numberposts' => 6, 'orderby' => 'rand', 'meta_key' => '_thumbnail_id'
);
ref: http://wordpress.org/support/topic/display-the-post-only-if-thumbnail-is-set-up?replies=17
Works great, thanks alot alchymyth
You must log in to post.