I'd like to query only pages with a certain page template with WP_Query or a function that would return the post object, but I can't find any information about that on the officiel codex.
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
Try this... Assuming the template name is 'my_template.php',
You can also use get_posts, or modify query posts to get the job done. Both these functions use the same parameters as WP_Query. |
|||
|
|
|
Incorrect: as of wordpress 3 you need something akin to:
|
||||
|
|
|
The page template is stored as a meta value with key "_wp_page_template". So all you need is to use that key in a meta query parameter. For examples and http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters |
|||
|
|
