Try adding
'paged' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1, // this will get the right posts for the current page (i.e. if the user loads www.domain.com/blog/page/2 directly)
'posts_per_page' => '6'
to your $args
and delete showposts
showposts
is deprecated.
From the Codex reference for WP_Query
:
showposts
(int) – number of posts to show per page. Deprecated as of Version 2.1 in favor of'posts_per_page'
.
Add Pagination links:
<?php next_posts_link( '← Older posts' ); ?>
<?php previous_posts_link( 'Newer posts →' ); ?>
Related Posts:
- Multiple Loops on category.php with pagination on last loop
- Pagination on category.php and tag.php not working
- Conditional category query breaking?
- Show the number of the post
- Loop within category’s posts
- WordPress Numeric Pagination with Query String [duplicate]
- Using pagination with multiple loops causes it to break
- How can I implement pagination on custom category page?
- How to check if I’m on the last page of posts?
- How can I create a category landing page followed by pages of posts?
- Should category.php and The Loop be used if the query needs to be customizable?
- Exclude the category from the WordPress loop
- get_field not displaying my custom field value
- Randomise results from a category page?
- Show div only if post is in specific category
- How to show a category post to a specific registered user
- How can I create a loop to build slides based on multiple categories using Coda Slider
- Categories list loop – add separator every year
- Listing all posts from current category on page
- Show posts of one category only with Custom Taxonomy on single.php
- Display one latest post from multiple categories
- Archive pagination causing 404 with permalinks structure
- How do I get the total number of categories in a list of search results?
- Display products for a category, sorted by post_excerpt
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- a-z list, categories and sub categories in loop
- Pagination Not Working on Category.php page
- Broken category pagination
- ?cat=-1 Indexed Versions Of Homepage
- How to loop only categories without posts (+ show category featured image with acf) [closed]
- Additional featured post on first page
- Show all posts for a specific category/author
- create a page which displays a list of categories title+ short description?
- Query Posts Exclude Entire Category
- Pagination for category slug returns 404 when page >= 2
- Class active for Archive link – looped out
- Pagination is not working properly in Product Category/Tag pages
- Paging not working in category.php
- How do I toggle pagination on/off in search results and category listings via a link?
- Counter in loop in foreach
- Custom post and category template pagination problem
- Order by category titles
- Inside a loop, how to change CSS class based on category name?
- Category template with pagination returns 404 on next pages
- Categories list loop – add separator every 3 categories [closed]
- How to display numbered pages in a category
- WordPress alphabetical A-Z custom post type post result display
- How to show 1-5 of X Total Results
- Category archive is displaying all posts rather than the specific category
- Trying to get variables in hacked category dropdown
- category__not_in and id values from variable
- How to display the parent category if only the child category has been chosen
- Category tags with comma’s
- Allow user to select categories that will display in post loop
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Getting the Most Recent Posts from Multiple Categories
- Display subcategories in dropdown
- Display category title and three latest post inside the category
- More efficient way to list posts by category [duplicate]
- Category nicename inside loop in wordpress
- filter a loop base on specific category
- Limit Loop to One Category
- Filter Category Loop Dynamically
- Pagination breaks on child-categories, works fine on parent-category
- Pagination for a category
- Editing Loop So It Targets Specific Tags?
- Problem: retrieving parent category’s first post
- Posts made to category don’t show up (do show up on frontpage)
- How do I remove pagination from just some Categories?
- Category name for all posts getting assigned to a single random post
- Category post count is not correct
- Display all categories but only if they have posts in them that have a specific tag assigned
- Include last post date in get_categories loop
- How to get specific (grand parent) category of current post?
- Custom Loop with certain number of one category
- how tho change number of posts in loop from specific categories
- Pagination for custom categories template
- Template category.php with page (no posts)
- Unable to create pagination for Category.php
- error in specific category loop
- loop in single.php of the same category
- Please tell how to stop the category from showing up on posts
- Hide a category/posts from the homepage in wp
- “Next posts” of a category do not call category.php
- Trying to display all posts in a category
- Display Taxonomies in loop with template args
- Paginations in Category Page Leads to Sample Pages
- How to exclude a specific categogy from a custom page template
- Transfering static site to wordpress and retaining category by month paginations
- How to get multiple loop in category.php, my scripts becomes madness
- Custom Category Page Not Working [duplicate]
- Paginating a list of all posts collected by category titles
- Paginate WordPress Category Pages
- How do i add custom post types to this query?
- Custom loop by url
- Do not show all post from all categories, just show posts from category in current loop
- IF have_posts contains posts from a certain category
- Echo Category In Loop
- Link to page in category