In this example, I have shared WordPress query pages with certain template. if post_type is left out WP will look for post, and you are looking for pages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php $args = array( 'post_type' => 'page',//it is a Page right? 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_wp_page_template', 'value' => 'template-city.php', ) ) ); $my_query = new WP_Query($args) ?> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.