Hey duderinos,
I’ve bashed and crowbar-ed the following together: when you create a WP post, you may want to use a thumbnail image somewhere – beside the title, for example.
You can do this using a custom field of course, but with the following if you don’t specify a thumbnail image to use then the first image you associate with that post will then automatically become the thumbnail instead.
Code:
get_var(“SELECT ID FROM $wpdb->posts WHERE post_parent = ‘$post->ID’ AND post_status = ‘inherit’ AND post_type=’attachment’ ORDER BY post_date ASC LIMIT 1”); ?>
ID, ‘thumbnail’, true);
if($thumbpath ==””) {
$thumbpath = $attachment_image;
}
?>
///USAGE///
Author
Posts
- The forum ‘Other’ is closed to new topics and replies.