Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Template Name: Tiles
- *
- * This template displays all child pages of a parent page
- * as a list of their titles .
- *
- */
- if ( ! defined( 'ABSPATH' ) ) exit;
- get_header(); ?>
- <div id="primary" <?php generate_content_class();?>>
- <main id="main" <?php generate_main_class(); ?>>
- <?php do_action('generate_before_main_content'); ?>
- <div class="ja-tiles-container">
- <!-- start loop -->
- <?php while ( have_posts() ) : the_post(); ?>
- <!-- child pages -->
- <?php
- $args = array(
- 'post_type' => 'page',
- 'posts_per_page' => -1,
- 'post_parent' => $post->ID,
- 'order' => 'ASC',
- 'orderby' => 'menu_order'
- );
- global $more;
- $more = 0;
- $parent = new WP_Query( $args );
- if ( $parent->have_posts() ) : ?>
- <?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
- <article id="parent-<?php the_ID(); ?>" class="parent-page ja-tiles-card">
- <div class="ja-tiles-inner">
- <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
- <div class="ja-tiles-description">
- <h2 class="ja-tiles-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
- <?php the_content(''); ?>
- </div>
- </div>
- </article>
- <?php endwhile; ?>
- <?php endif; wp_reset_query(); ?>
- <!-- /child pages -->
- </div>
- <?php endwhile; // end of the loop. ?>
- <!-- end loop -->
- <?php do_action('generate_after_main_content'); ?>
- </main><!-- #main -->
- </div><!-- #primary -->
- <?php
- do_action('generate_sidebars');
- get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement