Skip to content

Instantly share code, notes, and snippets.

@Tjobbe
Created January 20, 2013 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tjobbe/b8fc2849ec3e16cdc809 to your computer and use it in GitHub Desktop.
Save Tjobbe/b8fc2849ec3e16cdc809 to your computer and use it in GitHub Desktop.
wordpress pagination problem
<?php get_header(); ?>
<article class="main">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('posts_per_page=6&paged=' . $paged);
?>
<?php get_sidebar(); ?>
<div class="blogIndex">
<h2>Latest Posts</h2>
<?php query_posts('cat=-3,-9,-10,-11,-12,-13,-14'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
<h2><a href="<?php esc_url( the_permalink() ); ?>" title="Click to view: <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<!--time datetime="<?php the_time( 'Y-m-d' ); ?>" pubdate><?php the_date(); ?><?php //the_time(); ?></time-->
<?php the_excerpt(); ?>
<p class="button"><a href="<?php the_permalink(); ?>">read full post</a></p>
</article>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
</div>
<?php endif; ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<div class="prevNext">
<p class="nextPostsLink"><?php next_posts_link( __( '&larr; Older posts', 'twentyten' ) ); ?></p>
<p class="previousPostsLink"><?php previous_posts_link( __( 'Newer posts &rarr;', 'twentyten' ) ); ?></p>
</div>
<?php endif; ?>
</article>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment