Created
October 5, 2011 05:36
-
-
Save jkudish/1263730 to your computer and use it in GitHub Desktop.
Modify a query to show an archive of CPTs
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
<?php | |
add_action('pre_get_posts', 'ipstenu_pre_get_posts'); | |
function ipstenu_pre_get_posts($query){ | |
if ($query->is_page('name-of-your-page')) { // any and all conditionals work here as a method of the $query object | |
$query->set('post_type', 'video'); // use the set method as if you were using a regular WP_Query or query_posts etc... | |
$query->set('posts_per_page', 10); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment