Skip to content

Instantly share code, notes, and snippets.

@zulfnore
Created September 14, 2013 01:40
Show Gist options
  • Save zulfnore/6558084 to your computer and use it in GitHub Desktop.
Save zulfnore/6558084 to your computer and use it in GitHub Desktop.
WP_Query and pagination
<?php
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$strapvert_blog_query = new WP_Query(
array(
'paged' => $paged,
'post__not_in' => get_option( 'sticky_posts' ),
)
);
?>
<?php if ( $strapvert_blog_query->have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( $strapvert_blog_query->have_posts() ) : $strapvert_blog_query->the_post(); ?>
<?php
get_template_part( 'content', 'blog' );
?>
<?php endwhile; ?>
<?php strapvert_content_nav( 'nav-below' ); ?>
<?php else : ?>
<?php get_template_part( 'no-results', 'index' ); ?>
<?php endif; ?>
@zulfnore
Copy link
Author

Problem is pagination does not work - so what am I missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment