Jawn78

Untitled

Aug 22nd, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Grid
  4. * Description: Display sub-pages in a grid. Sub-pages should have featured image.
  5. * @package TheFour
  6. */
  7.  
  8. get_header(); ?>
  9.  
  10. <section id="content" class="content wide">
  11.  
  12. <?php if ( have_posts() ): the_post(); ?>
  13.  
  14. <?php get_template_part( 'template-parts/content', 'page' ); ?>
  15.  
  16. <?php endif; ?>
  17.  
  18. <?php
  19. $thefour_child_pages = new WP_Query( array(
  20. 'post_type' => 'page',
  21. 'orderby' => 'menu_order',
  22. 'order' => 'ASC',
  23. 'post_parent' => get_the_ID(),
  24. 'posts_per_page' => - 1,
  25. 'no_found_rows' => true,
  26. ) );
  27. ?>
  28.  
  29. <?php if ( $thefour_child_pages->have_posts() ) : ?>
  30. <div class="child-pages grid">
  31. <?php
  32. while ( $thefour_child_pages->have_posts() ) : $thefour_child_pages->the_post();
  33. get_template_part( 'template-parts/content', 'grid' );
  34. endwhile;
  35. ?>
  36. </div>
  37. <?php endif; ?>
  38.  
  39. <?php wp_reset_postdata(); ?>
  40.  
  41. <?php
  42. if ( comments_open() || get_comments_number() )
  43. {
  44. comments_template( '', true );
  45. }
  46. ?>
  47.  
  48. </section>
  49.  
  50. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment