Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

wordpress pagination issues

Posted on 2014-02-14
3
Medium Priority
?
947 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

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

Accepted Solution

by:
James Rodgers earned 2000 total points
ID: 39890670
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

604 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