-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathloop-template-filter.php
More file actions
36 lines (27 loc) · 976 Bytes
/
Copy pathloop-template-filter.php
File metadata and controls
36 lines (27 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/* ------------------------------------------------------------------------- *
* Custom Loop with Pages that have specific template set
*
* change "my-custom-template.php" whit your template
/* ------------------------------------------------------------------------- */
?>
<?php
$template_pages = new WP_Query( array(
'post_type' => 'page',
'no_found_rows' => true,
'post_status' => 'publish',
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => 3,
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'my-custom-template.php',
)
)
) ); ?>
<?php if ($template_pages->have_posts()) : while($template_pages->have_posts()) : $template_pages->the_post(); ?>
<?php the_post_thumbnail('thumbnail', array('class' => '','alt' => get_the_title())); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<?php endwhile; endif; ?>