Note: I’m posting this for myself so that I can refer to it in the future.
$cat_id =get_cat_id('Uncategorized'); $query = new WP_Query('cat='.$cat_id.'&year='.$year.'&monthnum='.$month.'&day='.$day); $image = false; while ( $query->have_posts() ) { $query->the_post(); the_title(); $image = wp_get_attachment_image_src(get_post_thumbnail_id($query->ID)); echo '<a href="'.$image[0].'">'; } |
More here for wp_get_attachment_image_src
Related: get_post_thumbnail.