Advertisement
sibweber

masonry-generate

Apr 12th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.89 KB | None | 0 0
  1. <?php
  2. /*
  3.  * Template Name: Tiles
  4.  *
  5.  * This template displays all child pages of a parent page
  6.  * as a list of their titles .
  7.  *
  8.  */
  9.  
  10. if ( ! defined( 'ABSPATH' ) ) exit;
  11.  
  12. get_header(); ?>
  13.  
  14.     <div id="primary" <?php generate_content_class();?>>
  15.         <main id="main" <?php generate_main_class(); ?>>
  16.             <?php do_action('generate_before_main_content'); ?>
  17.  
  18.             <div class="ja-tiles-container">
  19.  
  20.       <!-- start loop -->
  21.             <?php while ( have_posts() ) : the_post(); ?>
  22.  
  23.  
  24.       <!-- child pages -->
  25.         <?php
  26.  
  27.           $args = array(
  28.               'post_type'      => 'page',
  29.               'posts_per_page' => -1,
  30.               'post_parent'    => $post->ID,
  31.               'order'          => 'ASC',
  32.               'orderby'        => 'menu_order'
  33.            );
  34.  
  35.                      global $more;
  36.                      $more = 0;
  37.  
  38.                   $parent = new WP_Query( $args );
  39.  
  40.                   if ( $parent->have_posts() ) : ?>
  41.  
  42.  
  43.               <?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
  44.  
  45.  
  46.                   <article id="parent-<?php the_ID(); ?>" class="parent-page ja-tiles-card">
  47.                                         <div class="ja-tiles-inner">
  48.                       <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
  49.                                             <div class="ja-tiles-description">
  50.                                                 <h2 class="ja-tiles-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
  51.                                                 <?php the_content(''); ?>
  52.                                             </div>
  53.                                         </div>
  54.                   </article>
  55.  
  56.               <?php endwhile; ?>
  57.  
  58.  
  59.           <?php endif; wp_reset_query(); ?>
  60.           <!-- /child pages -->
  61. </div>
  62.  
  63.         <?php endwhile; // end of the loop. ?>
  64.         <!-- end loop -->
  65.  
  66.             <?php do_action('generate_after_main_content'); ?>
  67.         </main><!-- #main -->
  68.     </div><!-- #primary -->
  69.  
  70. <?php
  71. do_action('generate_sidebars');
  72. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement