Created
October 28, 2019 14:24
-
-
Save jbd91/2220bbbd75ba8f3c6643092fff19bd31 to your computer and use it in GitHub Desktop.
WP Query -- Query by Page Template
This file contains hidden or 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 | |
| $args = [ | |
| 'post_type' => 'page', | |
| 'meta_query' => [ | |
| [ | |
| 'key' => '_wp_page_template', | |
| 'value' => 'page-industry-detail.php' | |
| ] | |
| ] | |
| ]; | |
| $query = new WP_Query($args); | |
| if ($query->have_posts()) : ?> | |
| <?php while ($query->have_posts()) : $query->the_post(); ?> | |
| <h3><?php the_title(); ?></h3> | |
| <?php endwhile; ?> | |
| <?php wp_reset_postdata(); ?> | |
| <?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment