Skip to content

Instantly share code, notes, and snippets.

@coreyweb
Created May 19, 2012 22:07
Show Gist options
  • Save coreyweb/2732543 to your computer and use it in GitHub Desktop.
Save coreyweb/2732543 to your computer and use it in GitHub Desktop.
Get WP Pages by Custom Template Name
<?php /*
Get a list of all pages on a site, by their template name.
This is useful in determining which custom page templates are in use (and the reverse: which are not)
source: Jorge Pedret
http://jorgepedret.com/web-development/get-pages-by-template-name-in-wordpress/
*/
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'page-quote.php'
));
foreach($pages as $page){
echo $page->post_title.'<br />';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment