Return to Snippet

Revision: 41293
at February 15, 2011 18:03 by janvdm


Initial Code
<?php //GET THE FIRST IMAGE
                     	$args = array(
                     	'order'          => 'ASC',
                     	'orderby'        => 'menu_order',
                     	'post_type'      => 'attachment',
                     	'post_parent'    => $post->ID,
                     	'post_mime_type' => 'image',
                     	'post_sta	tus'    => null,
                     	);
                     	$attachments = get_posts($args);
                       		if ($attachments) {
                     
                     			foreach ($attachments as $attachment) {
                     
                     			echo wp_get_attachment_url($attachment->ID, 'full', false, false);
                     	}
                     } ?>');">

Initial URL

                                

Initial Description

                                

Initial Title
Wordpress Get The First Image

Initial Tags
image, wordpress

Initial Language
PHP