Created
October 19, 2013 09:26
-
-
Save rodica-andronache/7053546 to your computer and use it in GitHub Desktop.
Get ID of page that has a certain template
This file contains hidden or 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
| $the_query = new WP_Query( | |
| array( | |
| 'post_type' => 'page', | |
| 'meta_key' => '_wp_page_template', | |
| 'meta_value' => 'page-attorney.php' //aici e pagina templateului | |
| ) | |
| ); | |
| if ( $the_query->have_posts() ) { | |
| while ( $the_query->have_posts() ) { | |
| $the_query->the_post(); | |
| echo get_the_ID(); | |
| } | |
| } | |
| /* Restore original Post Data */ | |
| wp_reset_postdata(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment