Skip to content

Instantly share code, notes, and snippets.

@corygibbons
Last active December 11, 2015 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corygibbons/4526382 to your computer and use it in GitHub Desktop.
Save corygibbons/4526382 to your computer and use it in GitHub Desktop.
Function to echo a posts image urls
<?php function display_images_in_list($size = thumbnail) {
if($images = get_posts(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1, // show all
'post_status' => null,
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC',
))) {
foreach($images as $image) {
$attimg = wp_get_attachment_url($image->ID);
echo $attimg;
}
}
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment