Created
July 24, 2019 09:48
-
-
Save mdjwel/f769b0564f211f2a13270964e80da0e7 to your computer and use it in GitHub Desktop.
Get the page id by page template
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 | |
function filix_get_page_template_id( $template = 'page-job-apply-form.php' ) { | |
$pages = get_pages(array( | |
'meta_key' => '_wp_page_template', | |
'meta_value' => $template | |
)); | |
foreach($pages as $page){ | |
$page_id = $page->ID; | |
} | |
return $page_id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment