It’s far easier to use built-in loop functions such as pagination when you use a category template based on the template hierarchy.
You mentioned using the category ID to load posts into your custom template page, but if you instead name the template file based on the category ID, you can simply use the default WP loop, and include <?php echo paginate_links(); ?>
to display the pagination you seek.
Proper Category Template Naming w/ ID:
category-{ID}.php
Alternatively, if you prefer to press forward using your existing custom category template naming, you can still utilize paginate_links()
with $args
that correspond with your query.
Related Posts:
- Multiple Loops on category.php with pagination on last loop
- Pagination on category.php and tag.php not working
- How to do paging in the loop?
- 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
- Get the children of the parent category
- How to check if I’m on the last page of posts?
- Display posts from the same category using next/previous post link
- 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
- How do I get the category URL from get_the_category?
- Display all posts from all categories with pagination
- get_field not displaying my custom field value
- Default WP Gallery – show only galleries of a certain category
- Rearranging posts based on categories
- WP_Query not looking at child category
- Randomise results from a category page?
- Display all posts in category, with specific tag posts at top
- Show div only if post is in specific category
- Show Previous/Next Posts navigation only inside the same category
- How to show a category post to a specific registered user
- Display list of Sub-Categories and the posts they contain, within one main Category
- Loop with Dynamic Categories
- How can I create a loop to build slides based on multiple categories using Coda Slider
- Remove child products from woocommerce category page [closed]
- Get a list of commas separated categories inside a loop
- Categories list loop – add separator every year
- How would you create a “weekly” archive?
- How to exclude categories from recent posts, recent comments & category widgets?
- Page navigation within a category
- Listing all posts from current category on page
- Show posts of one category only with Custom Taxonomy on single.php
- Pagination on child category returns 404
- Disable pagination only for specific category
- Display one latest post from multiple categories
- Archive pagination causing 404 with permalinks structure
- Custom category template pagination problem
- How can i call an article from each category and still paginate properly?
- How do I get the total number of categories in a list of search results?
- Check if post belongs to any category
- Show posts of category in a page
- How do I display the posts from a custom post type on a category.php page?
- How to group the loop posts in a particular by author?
- Display products for a category, sorted by post_excerpt
- Force category-slug.php to show page, even if it doesn’t exist
- Exclude category from loop not working
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- If newest post of category is newest post in general, skip first post of category
- a-z list, categories and sub categories in loop
- Why would in_category only return one post in a specific category?
- Is it possible to select and edit the way the most recent post from a certain category is displayed on the page?
- Pagination Not Working on Category.php page
- 3 Columns, 3 Categories, One Archive, and Pagination
- Broken category pagination
- Displaying multiple loops based off of category
- ?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
- Five posts from a category in footer
- Show all posts for a specific category/author
- Redirect category to url with /category
- create a page which displays a list of categories title+ short description?
- Enter a variable in the ‘category_name’ parameter
- Second level subcategory
- how to define category loop last class in the third
- Query Posts Exclude Entire Category
- Pagination for category slug returns 404 when page >= 2
- Class active for Archive link – looped out
- Taxonomy name repeating when showing 2 posts from each category
- Pagination not visible on woocommerce’s category page
- Pagination is not working properly in Product Category/Tag pages
- Display the last post by each category?
- Restoring default article pagination on archives – Removing custom limits
- The default code for “posts_nav_link” on category.php isn’t working
- Remove product category placeholder image (Woocomerce)
- Why category.php throw 404 in wordpress while calling paginate_links()?
- Paging not working in category.php
- How do I toggle pagination on/off in search results and category listings via a link?
- WooCommerce – How to show specific category first-rest of products-specific category last
- Counter in loop in foreach
- How to exclude the last post from a category(featured for example) from the main loop?
- Custom post and category template pagination problem
- How to make the link to the category for a post go to corresponding page number in archive?
- Category archives with monthly pagination
- category pagination got broken suddenly
- Order by category titles
- Pagination for ajax category filter
- ajax for filtering posts by category in wordpress loops
- Inside a loop, how to change CSS class based on category name?
- Exclude current post from loop
- Category template with pagination returns 404 on next pages
- How to insert category list into post creation page, and retrieve chosen categories?
- Categories list loop – add separator every 3 categories [closed]
- How to display numbered pages in a category
- Limit get_categories to show each category once