Created
February 25, 2013 23:23
-
-
Save lschatzkin/5034288 to your computer and use it in GitHub Desktop.
Genesis custom gallery function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tl_create_gallery () | |
{ | |
$postID = get_the_ID(); | |
$args = array( | |
'numberposts' => 10, | |
'order'=> 'ASC', | |
'post_mime_type' => 'image', | |
'post_parent' => $postID, | |
'post_status' => null, | |
'post_type' => 'attachment' | |
); | |
$images = get_children( $args ); | |
echo '<div class="single-property-gallery">'; | |
if ($images) { | |
foreach($images as $image) { | |
$image_attributes = wp_get_attachment_image_src( $image->ID, 'property-thumb' ) ? wp_get_attachment_image_src( $image->ID, 'property-thumb' ) : wp_get_attachment_image_src( $image->ID, 'full' ); | |
$full_url = wp_get_attachment_image_src( $image->ID, 'full'); | |
echo '<a href="' .$full_url[0]. '"><img src="'. $image_attributes[0] . '" width="'.$image_attributes[1].'" height="'. $image_attributes[2].'" class="property-thumb"></a>'; | |
} | |
} | |
echo '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment