Last active
July 28, 2016 09:34
-
-
Save JAW-Dev/ce790319a139e2d2b364 to your computer and use it in GitHub Desktop.
WordPress Custom Query Paged
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
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$query = new WP_Query(array( | |
'post_type' => 'post', | |
'no_found_rows' => true, | |
'no_found_rows' => true, // useful when pagination is not needed. | |
'update_post_meta_cache' => false, // useful when post meta will not be utilized. | |
'update_post_term_cache' => false, //useful when taxonomy terms will not be utilized. | |
'fields' => 'ids', //useful when only the post IDs are needed (less typical). | |
)); | |
if (have_posts()) : | |
while ($query->have_posts()) : | |
$query->the_post(); | |
endwhile; | |
endif; | |
wp_reset_postdata(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment