Display All Post Attachments and Assign Class to the Last Image?

This should do it, I think: function get_images() { global $post; $attachment = get_children(array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘numberposts’ => -1 ), ARRAY_N ); if ( $attachment ) { $attachment_count = count($attachment); foreach($i=0; $i < $attachment_count; $i++) { $last = ($i == ($attachment_count-1) ) ? ‘ last’ … Read more

WP Insert Post function – Insert Post Thumbnail

you need to first create the post and get the id: $postit = array( ‘post_title’ => $itemtitle, ‘post_content’ => ”, ‘post_status’ => ‘publish’, ‘post_type’ => ‘items’, ‘post_author’ => $user_ID, ‘tags_input’ => $the_post_id ); $the_post_idit = wp_insert_post( $postit); Once you have the post id you can use update_post_meta( $the_post_idit,’_thumbnail_id’,$itemimage); just make sure that $itemimage holds the … Read more

Archive Thumbnail Gallery

You can use the code on the site you linked to with post thumbnails, if you change one line. Instead of <img src=”https://wordpress.stackexchange.com/questions/26484/<?php echo get_post_meta($post->ID,”thumb’, true) ?>” alt=”<?php the_title(); ?>” /> Use <?php the_post_thumbnail(); ?> See the Codex for more information.