WordPress pagination showing same content on page 2
-
I can’t link to the site I’m working on because it’s running locally right now. I’m trying to use pagination on the home page but what happens is that it’s displaying a link for Page 2 and Page 3 but it’s not showing any different content when I click the links.
I’m using the bootstrap framework (no plugin). I want to try pagination without using a plugin.
I have a query running on the home page that pulls in the latest 3 posts into the first 3 columns (1,2,3).
I have an additional query running on the home page that pulls in the next 3 posts into 3 columns beneath the first 3 (4,5,6).
When the pagination displays, I click on the numbers and the url changes in the address bar but the content remains the same. Is there a way I can use pagination to continue to display 3 columns on top and 3 columns on bottom?
Please help, thanks!
In my functions.php I have:
function bootstrap_pagination($pages = '', $range = 2) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "<div class='pagination pagination-centered'><ul>"; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<li><a href='".get_pagenum_link(1)."'>«</a></li>"; if($paged > 1 && $showitems < $pages) echo "<li><a href='".get_pagenum_link($paged - 1)."'>‹</a></li>"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "<li class='active'><span class='current'>".$i."</span></li>":"<li><a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a></li>"; } } if ($paged < $pages && $showitems < $pages) echo "<li><a href='".get_pagenum_link($paged + 1)."'>›</a></li>"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<li><a href='".get_pagenum_link($pages)."'>»</a></li>"; echo "</ul></div>\n"; } }
Query 1 looks like this:
<div id="post-<?php the_ID(); ?>" class="span4"> <div class="our-work-thumbs"> <?php // check if the post has a Post Thumbnail assigned to it. if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?> <h4><?php the_title(); ?> - <span><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">view project</a></span></h4> </div> </div> <?php $count1++; } ?> <?php endforeach; ?> </div> <!------------ FIRST ROW ---------------->
Query 2 looks like this:
<div id="post-<?php the_ID(); ?>" class="span4"> <div class="our-work-thumbs"> <?php // check if the post has a Post Thumbnail assigned to it. if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?> <h4><?php the_title(); ?> - <span><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">view project</a></span></h4> </div> </div> <?php $count2++; } ?> <?php endforeach; ?> </div> <?php endif; ?> <!------------ SECOND ROW ---------------->
- The topic ‘WordPress pagination showing same content on page 2’ is closed to new replies.