1$args = array(
2 'post_type' => 'page',
3 'posts_per_page' => -1,
4 'meta_query' => array(
5 array(
6 'key' => '_wp_page_template',
7 'value' => 'page_list_R_ea_modelling_instructor_led.php' // Template file name
8 )
9 )
10);
11$the_pages = new WP_Query( $args );
12
13echo "<pre>";print_r($the_pages->posts);exit;
1global $wpdb;
2
3$sql = "SELECT post_title, meta_value
4 FROM $wpdb->posts a
5 JOIN $wpdb->postmeta b ON a.ID = b.post_id
6 WHERE a.post_type = 'page'
7 AND a.post_status = 'publish'
8 AND b.meta_key = '_wp_page_template'
9 ";
10
11$pages = $wpdb->get_results($sql);
12
13echo '<pre>';
14print_r($pages);
15echo '</pre>';