Created
September 12, 2018 17:22
-
-
Save ciaranha/7dadfdf82faccaff653179913913db7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<div class="container-narrow mt-80"> | |
<?php | |
function list_pages_for_template($template_name) { | |
echo '<strong>'; | |
echo $template_name; | |
echo '</strong>'; | |
$args = array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
'meta_query' => array( | |
array( | |
'key' => '_wp_page_template', | |
'value' => $template_name | |
) | |
) | |
); | |
$the_pages = new WP_Query( $args ); | |
if( $the_pages->have_posts() ){ | |
while( $the_pages->have_posts() ){ | |
$the_pages->the_post(); | |
echo '<li>'; | |
the_title(); | |
echo '</li>'; | |
} | |
} | |
wp_reset_postdata(); | |
} | |
$templates = array( | |
'template-master.php', | |
'template-integrations.php', | |
'template-landing.php' | |
); | |
foreach($templates as $template) { | |
echo '<div class="mt-40">'; | |
list_pages_for_template($template); | |
echo '</div>'; | |
} | |
?> | |
</div> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment