Return to Snippet

Revision: 36636
at November 24, 2010 08:17 by jazzikins


Initial Code
<?php
//Get images attached to the post
$args = array(
	'post_type' => 'attachment',
	'post_mime_type' => 'image',
	'numberposts' => -1,
        'order' => 'ASC',
	'post_status' => null,
	'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
	foreach ($attachments as $attachment) {
		$img = wp_get_attachment_thumb_url( $attachment->ID );
                break;
        }
//Display image
}
?>

Initial URL

                                

Initial Description
For Wordpress. Used to get the url of the post Thumbnail.

Initial Title
Get Post Thumbnail

Initial Tags
wordpress

Initial Language
PHP