Pagination for posts inside a specific category

Create a category-faq.php in your theme folder ( assuming category is your taxonomy and faq is the term slug ), and put your category code in there, and add pagination code to that file. This is a category specific template. For a view of what templates you can add and the types of instances they … Read more

Add pagination to this following template

Firstly, you have 2 queries, the second is overriding the first: <?php query_posts($query_string . ‘&pagename=&page_id=’); ?> <?php query_posts(‘posts_per_page=3’); ?> Replace them with a single query: <?php query_posts($query_string . ‘&pagename=&page_id=&posts_per_page=3’); ?> Then modify your query as such: ‘paged’ => ( get_query_var(‘paged’) ? get_query_var(‘paged’) : 1 ) e.g. <?php query_posts($query_string . ‘&pagename=&page_id=&posts_per_page=3&page=”.( get_query_var(“paged’) ? get_query_var(‘paged’) : 1 … Read more

Category pagination not working

You should take a closer look at the [http://codex.wordpress.org/Template_Hierarchy Template Hierarchy]. From what I understood in your code is that you’re trying to list posts in the category where ID = 5. You can easily map that to the category-slug.php or category-id.php template files, so you won’t have to do any extra get_posts. The problem … Read more

Page not found yet the posts are listed?

It’s not correct solving of issue and it’s not a bug. Here is explanation why it happens: “Pagination is calculated before you get to the template file that runs query_posts. The proper way to alter posts_per_page conditionally is to use the pre_get_posts hook to modify the main query.” https://wordpress.stackexchange.com/a/42063/17177 I found one implementation “pre_get_posts” that … Read more

paginate posts on admin page

This is what ended up solving it (I’ll include the relevant parts) $total = wp_count_posts()->publish; $perpage = 10; $curpage = isset( $_GET[‘pagenum’] ) ? intval($_GET[‘pagenum’]) : 1; global $post; $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ‘posts_per_page’ => $perpage, ‘offset’ => $perpage*($curpage-1) ); $pages = ceil($total/$perpage); $dash_posts … Read more

error code: 521