Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Function for displaying Property gallery
- function propertyGallery() {
- global $post;
- // Get images for this post
- $arrImages =& get_children('post_type=attachment&post_mime_type=image&post_parent=' . $post->ID );
- // If images exist for this page/post
- if($arrImages) {
- //Sort the array by menu order
- usort($arrImages, 'cmpMenuOrder');
- // Get SRC of large image
- $image = wp_get_attachment_image_src($arrImages[0]->ID, "large-property");
- echo " <div id=\"propertygallery\">\n";
- echo " <img class=\"starterimg\" src=\"".$image[0]."\" alt=\"\" />\n";
- echo " <div id=\"gallerysmimgcont\">\n";
- echo " <div id=\"gallerysmimgcont-inner\">\n";
- // Loop through images
- foreach($arrImages as $key => $data) {
- $imagelarge = wp_get_attachment_image_src($data->ID, "large-property");
- $imagesmall = wp_get_attachment_image_src($data->ID, "small-property");
- echo " <a href=\"".$imagelarge[0]."\" target=\"_blank\"><img src=\"".$imagesmall[0]."\" alt=\"\" /></a>\n";
- }
- echo " </div>\n";
- echo " <div class=\"overnav\" id=\"imggaldown\"> </div>\n";
- echo " <div class=\"overnav\" id=\"imggalup\"> </div>\n";
- echo " </div>\n";
- echo " </div>\n";
- }
- }
- function cmpMenuOrder($a, $b) {
- if( $a->menu_order == $b->menu_order ){ return 0 ; }
- return ($a->menu_order < $b->menu_order) ? -1 : 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement