Skip to content

Instantly share code, notes, and snippets.

@illucent
Created February 14, 2014 10:26
Show Gist options
  • Select an option

  • Save illucent/8998898 to your computer and use it in GitHub Desktop.

Select an option

Save illucent/8998898 to your computer and use it in GitHub Desktop.
function ajax_get_latest_posts(){
$attachments = get_children(array('post_parent' => $post->ID,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID'));
$allimagesizes = array();
foreach($attachments as $att_id => $attachment) {
$large_bg_url = wp_get_attachment_image_src($attachment->ID, 'background-large');
$medium_bg_url = wp_get_attachment_image_src($attachment->ID, 'background-medium');
$small_bg_url = wp_get_attachment_image_src($attachment->ID, 'background-small');
$imagesizes = array('background_large' => $large_bg_url[0], 'background_medium' => $medium_bg_url[0], 'background_small' => $small_bg_url[0]);
$allimagesizes[] = $imagesizes;
}
return $allimagesizes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment