Advertisement
Guest User

Custom Gallery

a guest
Mar 28th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <div class="<?php the_title(); ?>-page">
  4.  
  5.  
  6. <?php
  7. $albumlist = get_terms('albums');
  8. foreach($albumlist as $albums) {
  9.     $albums = $albums->name;
  10.     $args = new WP_Query(array('posts_per_page' => -1, 'orderby' => title, 'albums' => $albums));
  11. ?>
  12. <div class="entrytext">
  13.     <div id="photos">
  14.         <?php $photoquery = new WP_Query($args);
  15.     while ($photoquery->have_posts()):
  16.         $photoquery->the_post(); ?>  
  17.         <?php if (has_post_thumbnail($post->ID)): ?>
  18.         <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail'); ?>      
  19.             <article class="photo">
  20.                 <div class="featuredimage" style="background-image: url('<?php echo $image[0]; ?>')"></div>
  21.             </article> <!-- .photo -->
  22.         <?php
  23.         else: ?>
  24.     <?php
  25.         endif; ?>
  26.     <?php
  27.     endwhile; ?>
  28.     </div> <!-- #photos -->
  29. </div> <!-- entrytext -->
  30. <?php wp_reset_query(); ?>
  31. <?php rewind_posts(); ?>
  32. <?php
  33. } // End foreach %albums
  34.  ?>
  35.         </div> <!-- "title"-page -->
  36.  
  37. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement