Get page by template?
The page template’s filename is stored as a post meta with key ‘_wp_page_template’, so basically you can use get_post_meta($post_id, ‘_wp_page_template’, true); to get the template filename for the page with ID $post_id. You can also do the reverse (i.e. getting id from page template filename) using Custom Field Parameters in WP_Query or other wordpress functions. … Read more