Last active
January 29, 2016 10:15
-
-
Save EmranAhmed/b713352cdaec1f1030ee to your computer and use it in GitHub Desktop.
List pages 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 = array( | |
| 'posts_per_page' => -1, // List All page | |
| 'post_type' => 'page', | |
| 'meta_query' => array( | |
| array( | |
| 'key' => '_wp_page_template', | |
| 'value' => 'page-template.php', // Your page template name, If you have page template in a directory like: page-templates, then you should specify it like: page-template/page-template.php :) | |
| 'compare' => '=' | |
| ) | |
| ) | |
| ); | |
| $page = new WP_Query( $args ); | |
| print_r( $page ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment