WordPress.org

Ready to get started?Download WordPress

Forums

Change Attached image size for Archive,Post,Home Loops (1 post)

  1. allstar
    Member
    Posted 4 years ago #

    I've found this snippet that lets me echo out the thumbnail size for the first photo but I'm still displaying the original photo. Any idea how to remove the first image? The surely then its just a case of using conditionals to control the function calls $args?

    function get_post_image($size = 'thumbnail') {
    	global $post;
    
    	$photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
    
    	if ($photos) {
    		$photo = array_shift($photos);
    		return wp_get_attachment_image($photo->ID, $size);
    	}
    	return false;
    }
    $photo = get_post_image();

Topic Closed

This topic has been closed to new replies.

About this Topic