You can simply make use of get_pages
to retrieve all pages which have a meta_value
of the specified template:
1 2 3 4 5 6 7 | $pages = get_pages(array( 'meta_key' => '_wp_page_template', 'meta_value' => 'page-special.php' )); foreach($pages as $page){ echo $page->ID.'<br />'; } |
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.