/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- GALLERY VIEW--> <div class="gallery"> <?php $mainGallery = new WP_Query(); $mainGallery->query('post_type=post&showposts=5'); $i=1; ?> <?php while ($mainGallery->have_posts()) : $mainGallery->the_post(); 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => 1, 'order' => 'DESC', 'orderby' => 'date', 'post_mime_type' => 'image')); foreach($mainGalleryPic as $listele ) { $img=wp_get_attachment_image_src($listele->ID, 'mainProjects'); $cap=$listele->post_title; } ?> <!-- BLOCK --> <div class="block <?php if($i==1) { echo 'noBg noPadl'; } elseif($i==5) { echo 'noMarr'; } ?>"> <h2>NEWEST</h2> <h3><?php the_title(); ?></h3> <h4>Online</h4> <div class="thumb <?php if($i%2==0) { echo 'small'; } else { echo 'full'; } ?>"> <img src="<?php echo $img[0]; ?>" alt="<?php the_title(); ?>"> </div> <a href="<?php the_permalink(); ?>">Click for more</a> </div> <!-- /BLOCK --> <?php $i++; endwhile; ?> </div> <!-- /GALLERY VIEW-->