Solved

wordpress pagination issues

Posted on 2014-02-14
3
895 Views
Last Modified: 2014-03-20
hi all,

I'm trying to paginate posts from a blog. The code I have works however when I click the pagination link to move to another page it is simply listing the first page all the time?

I'm using the default twentyfourteen_paging_nav() code which has not been altered at all.

The link for example for page 2 is /blog/page/2

I assume I am missing something simply here? Do I need to parse and chose the relevant page?

<?php
$args = array( 'posts_per_page' => 4, 'post_type' => 'post', 'post_status'=> 'publish', );
query_posts($args);

if ( have_posts() ) : while ( have_posts() ) : the_post();
?>

<hr/>

<?php the_title( '<h1><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); ?>
<div class="stripe-line-search"></div>
<div style="clear:both"></div>

<div class="entry-summary">
<div style="clear:both;"></div>
<a href="<?php the_permalink(); ?>" class="blog-thumb-image">
<?php the_post_thumbnail( array(120,120) ) ?>
</a>
<?php the_excerpt(); ?>
<a class="main-link" href="<?php echo get_permalink($current_page->ID); ?>">
Find out more</a>
<div style="clear:both;"></div>
</div>
<?php 
endwhile; else:
// No posts.
endif;

twentyfourteen_paging_nav();

wp_reset_query();

?>

Open in new window

0
Comment
Question by:flynny
3 Comments
 

Author Comment

by:flynny
Comment Utility
Hi any chance for a bump on this to find out whats going on?
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 500 total points
Comment Utility
pretty sure you are missing "paged" from your args

something like

if ( get_query_var('paged') ) {
					  $paged = get_query_var('paged');
					} elseif ( get_query_var('page') ) {
					  $paged = get_query_var('page');
					} else {
					  $paged = 1;
					}
				
				query_posts("cat=" . implode(',',$arrCategory_ids)."&paged=".$paged) ;

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now