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 do I get the category URL from get_the_category?
- Display all posts from all categories with pagination
- Default WP Gallery – show only galleries of a certain category
- Display all posts in category, with specific tag posts at top
- Show Previous/Next Posts navigation only inside the same category
- Loop with Dynamic Categories
- How can I create a loop to build slides based on multiple categories using Coda Slider
- 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?
- Listing all posts from current category on page
- Show posts of one category only with Custom Taxonomy on single.php
- Custom category template pagination problem
- Force category-slug.php to show page, even if it doesn’t exist
- 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
- Why would in_category only return one post in a specific category?
- ?cat=-1 Indexed Versions Of Homepage
- Class active for Archive link – looped out
- Taxonomy name repeating when showing 2 posts from each category
- Display the last post by each category?
- Restoring default article pagination on archives – Removing custom limits
- Why category.php throw 404 in wordpress while calling paginate_links()?
- Counter in loop in foreach
- How to exclude the last post from a category(featured for example) from the main loop?
- Category archives with monthly pagination
- Order by category titles
- Pagination for ajax category filter
- ajax for filtering posts by category in wordpress loops
- Limit get_categories to show each category once
- Display single category name in woocommerce loop
- Show Posts from Single Category Not Working
- Is there a reason I cannot get the current category in a loop?
- Category archive is displaying all posts rather than the specific category
- new WP_Query all post in a category inside the loop
- How to add orderby parameter for sorting on category.php
- How to loop custom post_type from (a) specific category(ies)?
- How to display the parent category if only the child category has been chosen
- Category tags with comma’s
- Display posts of certain categories to specific user roles
- Remove any product that is featured from regular display loop [WooCommerce]
- More efficient way to list posts by category [duplicate]
- Category nicename inside loop in wordpress
- Pagination doesn’t work on multiple categories
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- Pagination for a category
- Editing Loop So It Targets Specific Tags?
- Problem: retrieving parent category’s first post
- Category pagination not working
- Posts made to category don’t show up (do show up on frontpage)
- How do I remove pagination from just some Categories?
- 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?
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- how tho change number of posts in loop from specific categories
- Pagination for custom categories template
- 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
- Assign a class to first element in category in loop
- “Next posts” of a category do not call category.php
- Trying to display all posts in a category
- Category page shows only 1 post when that post has more than 1 category?
- Configure query with multiple categories in a custom order?
- How can I modify this code to iterate over an array of categories?
- 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]
- My Query is getting the wrong data
- How do i add custom post types to this query?
- Custom loop by url
- Custom WordPress category page showing all posts rather than the specified category
- Can i know if it is Category first page or 5th?
- Do not show all post from all categories, just show posts from category in current loop
- Exclude posts from certain category breaks custom pagination
- IF have_posts contains posts from a certain category
- i want to add pagination list of categories
- Echo Category In Loop
- Link to page in category
- Get categories by title descendant
- wordpress category rewrite rule with pagination
- Pagination only showed when no category is set in wp_query