Programming, WordPress

Get the list of particular page template used in the website

Have you ever used the same template page in the multiple pages?  Do you want get the list of the pages that uses same template page in the whole site? If yes, use get_pages() function to retrieve the list of pages using the same template page.

In the get_pages() function pass the meta_key as _wp_page_template and value as template_name following template folder. Suppose, I have template page custom-cms.php inside the templates folder of  theme, then my code to get the list of pages using the custom-cms.php template is :

To learn more about get_pages() function visit codex.

 

Hits: 16

Standard