Guest User

Scott Cariss

a guest
Oct 25th, 2010
1,271
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Function for displaying Property gallery
  2. function propertyGallery() {
  3.     global $post;
  4.  
  5.     // Get images for this post
  6.     $arrImages =& get_children('post_type=attachment&post_mime_type=image&post_parent=' . $post->ID );
  7.  
  8.     // If images exist for this page/post
  9.     if($arrImages) {
  10.        
  11.         //Sort the array by menu order
  12.         usort($arrImages, 'cmpMenuOrder');
  13.        
  14.         // Get SRC of large image
  15.         $image = wp_get_attachment_image_src($arrImages[0]->ID, "large-property");
  16.  
  17.         echo "          <div id=\"propertygallery\">\n";
  18.         echo "            <img class=\"starterimg\" src=\"".$image[0]."\" alt=\"\" />\n";
  19.         echo "            <div id=\"gallerysmimgcont\">\n";
  20.         echo "              <div id=\"gallerysmimgcont-inner\">\n";
  21.        
  22.         // Loop through images
  23.         foreach($arrImages as $key => $data) {
  24.             $imagelarge = wp_get_attachment_image_src($data->ID, "large-property");
  25.             $imagesmall = wp_get_attachment_image_src($data->ID, "small-property");
  26.             echo "                <a href=\"".$imagelarge[0]."\" target=\"_blank\"><img src=\"".$imagesmall[0]."\" alt=\"\" /></a>\n";
  27.         }
  28.        
  29.         echo "              </div>\n";
  30.         echo "              <div class=\"overnav\" id=\"imggaldown\">&nbsp;</div>\n";
  31.         echo "              <div class=\"overnav\" id=\"imggalup\">&nbsp;</div>\n";
  32.         echo "            </div>\n";
  33.         echo "          </div>\n";
  34.        
  35.     }
  36.    
  37. }
  38. function cmpMenuOrder($a, $b) {
  39.     if( $a->menu_order ==  $b->menu_order ){ return 0 ; }
  40.     return ($a->menu_order < $b->menu_order) ? -1 : 1;
  41. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×