Here are the functions you need to be aware of:
- http://codex.wordpress.org/Function_Reference/get_post_thumbnail_id
- http://codex.wordpress.org/Function_Reference/wp_get_attachment_url
- http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src
- http://codex.wordpress.org/Function_Reference/wp_get_attachment_image
Example sans size:
echo wp_get_attachment_url(get_post_thumbnail_id());
Example with size:
$image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
echo $image[0]; //as HREF in your A tag
You can grab all of the gallery images as follows:
$args = array(
'order'=> 'ASC',
'post_mime_type' => 'image',
'post_parent' => $post->ID,
'post_type' => 'attachment'
);
$attachments = get_children( $args );
foreach($attachments as $attachment){
//use $attachment->ID to retrieve attachment information
$image = wp_get_attachment_image_src($attachment->ID, 'large');
}