Guest User

Untitled

a guest
Jul 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 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. 'post_parent' => $parent,
  21. 'meta_key' => '_thumbnail_id'
  22. ));
  23.  
  24. while (have_posts()) : the_post(); ?>
  25.  
  26. <?php $width = (ceil($wp_query->current_post/2)%2) ? 'thin-detail' : 'wide-detail'; ?>
  27.  
  28. <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $width );
  29. $url = $thumb['0']; ?>
  30.  
  31. <div class="detailthumb-<?php echo (ceil($wp_query->current_post)%4)+1; ?>"
  32. style="background-image: url('<?php echo $url; ?>');">
  33.  
  34. <a class="subpage-link" href="<?php the_permalink(); ?>">
  35. <span class="detail-title"><?php the_title(); ?></span>
  36. </a>
  37.  
  38. </div>
  39.  
  40.  
  41. <?php endwhile; ?>
  42.  
  43. </div> <!--Main-->
  44.  
  45. <div class="clear">&nbsp;</div>
  46.  
  47. </div> <!--Main Container (Subpages)-->
  48.  
  49. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment