[theme: jointswp] pagination not working
-
Hello, I’m fairly new to wordpress & my php skills are limited. I’ve been using the JointsWP theme to make a WordPress site & have been loving it so far because I’m so used to the Foundation front-end framework – until now.
I’m displaying 5 posts per page (set in the settings->reading section of the backend) and the pagination links are showing up at the bottom of the page but when I click on them instead of loading new posts on the new page it loads the same posts from the first page. I’m developing this site on my localhost so here’s the code I’m using:
This problem is in the index.php:
<?php if (have_posts()) :query_posts('category_name=announcements'); while (have_posts()) : the_post(); ?> <?php get_template_part( 'partials/loop', 'archive' ); ?> <?php endwhile; ?> <?php if (function_exists('joints_page_navi')) { ?> <?php joints_page_navi(); ?> <?php } else { ?> <nav class="wp-prev-next"> <ul class="clearfix"> <li class="prev-link"><?php next_posts_link(__('« Older Entries', "jointstheme")) ?></li> <li class="next-link"><?php previous_posts_link(__('Newer Entries »', "jointstheme")) ?></li> </ul> </nav> <?php } ?> <?php else : ?> <?php get_template_part( 'partials/content', 'missing' ); ?> <?php endif; ?>
& here’s the joints_page_navi function:
function joints_page_navi($before = '', $after = '') { global $wpdb, $wp_query; $request = $wp_query->request; $posts_per_page = intval(get_query_var('posts_per_page')); $paged = intval(get_query_var('paged')); $numposts = $wp_query->found_posts; $max_page = $wp_query->max_num_pages; if ( $numposts <= $posts_per_page ) { return; } if(empty($paged) || $paged == 0) { $paged = 1; } $pages_to_show = 7; $pages_to_show_minus_1 = $pages_to_show-1; $half_page_start = floor($pages_to_show_minus_1/2); $half_page_end = ceil($pages_to_show_minus_1/2); $start_page = $paged - $half_page_start; if($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if(($end_page - $start_page) != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if($start_page <= 0) { $start_page = 1; } echo $before.'<nav class="page-navigation"><ul class="pagination">'.""; if ($start_page >= 2 && $pages_to_show < $max_page) { $first_page_text = __( "First", 'jointstheme' ); echo '<li class="bpn-first-page-link"><a href="'.get_pagenum_link().'" title="'.$first_page_text.'">'.$first_page_text.'</a></li>'; } echo '<li class="bpn-prev-link">'; previous_posts_link('<<'); echo '</li>'; for($i = $start_page; $i <= $end_page; $i++) { if($i == $paged) { echo '<li class="current"><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>'; } else { echo '<li><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>'; } } echo '<li class="bpn-next-link">'; next_posts_link('>>'); echo '</li>'; if ($end_page < $max_page) { $last_page_text = __( "Last", 'jointstheme' ); echo '<li class="bpn-last-page-link"><a href="'.get_pagenum_link($max_page).'" title="'.$last_page_text.'">'.$last_page_text.'</a></li>'; } echo '</ul></nav>'.$after.""; }
I’m really lost here & don’t know how to fix this. let me know if you need to see more code. I’m willing to try something else like infinite post or a pagination plugin if that makes more sense…anything but a busted pagination! thank you for your help!!!
- The topic ‘[theme: jointswp] pagination not working’ is closed to new replies.