Advertisement
Guest User

Subpages Gallery Template Page Final

a guest
Apr 12th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Subpages Thumbnail Page
  4. */
  5. ?>
  6.  
  7. <?php get_header(); ?>
  8.  
  9. <div id="main-container-subpages">
  10.  
  11. <div class="main">
  12.  
  13. <span style="display:none;"><?php the_ID(); ?></span>
  14. <?php $parent = $post->ID; ?>
  15.  
  16. <?php
  17. query_posts( array(
  18. 'posts_per_page' => 8,
  19. 'post_type' => 'page',
  20. 'paged' => get_query_var('paged'),
  21. 'post_parent' => $parent,
  22. 'meta_key' => '_thumbnail_id'
  23. ));
  24.  
  25. while (have_posts()) : the_post(); ?>
  26.  
  27. <?php $width = (ceil($wp_query->current_post/2)%2) ? 'thin-detail' : 'wide-detail'; ?>
  28.  
  29. <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $width );
  30. $url = $thumb['0']; ?>
  31.  
  32. <div class="detailthumb-<?php echo (ceil($wp_query->current_post)%4)+1; ?>"
  33. style="background-image: url('<?php echo $url; ?>');">
  34.  
  35. <a class="subpage-link" href="<?php the_permalink(); ?>">
  36. <span class="detail-title"><?php the_title(); ?></span>
  37. </a>
  38.  
  39. </div>
  40.  
  41.  
  42. <?php endwhile; ?>
  43.  
  44.  
  45. <?php next_posts_link('<div class="more">MORE</div>'); ?>
  46.  
  47. </div> <!--Main-->
  48.  
  49. <div class="clear">&nbsp;</div>
  50.  
  51. </div> <!--Main Container (Subpages)-->
  52.  
  53. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement