Created
May 19, 2012 22:07
-
-
Save coreyweb/2732543 to your computer and use it in GitHub Desktop.
Get WP Pages by Custom Template Name
This file contains 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 /* | |
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