the pagination function does nothing with a custom loop
That’s because for custom loops or secondary WP_Query
instances like your $catquery
variable, you need to explicitly tell the function how many pages are available for your custom query.
So the $total
argument (see the function’s description) should be set to the max_num_pages
property of the query object, i.e. the $catquery
variable:
understrap_pagination( [
'total' => $catquery->max_num_pages,
] );
It’s that simple and the above should work. 🙂
Related Posts:
- Custom Loop Pagination on WordPress
- How can I add pagination and how can I change thumbnail size?
- Using loop pagination on single.php
- Custom Pagination is Broken
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- pagination broken – clicking next displays “page not found”
- How do I get pagination for get_posts() in WordPress or do I have to rewrite the whole code?
- Pagination contents not changing in Front page WordPress
- How can I get my pagination loop to display the correct number of total pages?
- Get current_post in reverse order with pagination
- Pagination on Custom Loop
- WordPress post pagination on custom template not working
- Pagination in category.php not functioning
- Pagination not working properly
- How to get URL of current page displayed?
- What is This esc_html_e() i wordpress php?
- Getting paginate_links() ‘end_size’ to display none
- I can’t fetch query parameters ($_GET parameters) with get_query_var
- Display only text to WordPress loop without loosing the text formatting
- WooCommerce – Customer Order History Pagination
- How to change post count in wordpress loop?
- How can I loop into two different DIVS without repeating the DIVs
- WordPress loop specific thumbnail size
- Add “last” and “first” to WordPress Comment Pagination Links
- WordPress get pagination on wpdb get_results
- Show Custom Taxonomy Title
- How to exclude specific category from the get_the_category(); array
- How can i display post loop in table format?
- Sorting Posts | Alphabetical Order
- How to get the Page Number of the Current Page in Single Post Pagination
- How to select WooCommerce products by post_meta and order them
- How to Display a Single Post Excerpt
- Cannot display or echo alt text on featured image
- Using Advanced Custom Fields to create a per page slider
- How can I properly control the numbers and dots that appear in pagination?
- WordPress Search Results for Multiple Post Types
- Changing layout with wp_customise
- Adding nofollow to a PHP generated Nav
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- How to show all pages in blog navigation?
- get author_name from queried post
- how to refresh div on template part?
- Display category name only once inside loop
- Pagination in plugin’s backend
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- PHP code to use on next & previouspage links
- post thumbnail, conditions, else wont work
- wp_query get the 2nd post
- How to create pagination for users list using custom array?
- Pagination on Custom Post
- How to add div blocks after certain set of post
- Why in my theme I can’t see all the statics content under the posts?
- How do I remove a category from a wordpress loop>
- How to unlink all posts from tracking same amount of views
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Problem with custom loop and wp_list_pluck [closed]
- Custom pagination (Previous / Next)
- Echo array value
- How to add title attribute to archive items
- Strip from or something better?
- How to break up php code to avoid echo
- Pagination in single.php
- Products listing check if meta checkbox is checked
- How to Create Carousel Indicators in PHP Loop using wp_get_attachment_url function?
- Get title of page containing post grid within the posts
- Is there anyway I can call the year once?
- static page pagination not working
- Foreach Loop Of Post Types With Nested If Else If Not Completing Process
- AJAX numerical pagination problem in TwentyFifteen-child theme
- cURL needing to loop through all “next_page”
- Display page content in different sections – based on page break block?
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- Show the subcategory name based on current product
- Pagination – Previous link is not show and Next link sticks at page 2
- How do if all posts has this category ID then do this
- ERR_TOO_MANY_REDIRECTS / To Force SSL Logins and SSL Admin Access
- View tag description on page
- Add a leading zero to pagination
- Insert div after every three posts in home.php [duplicate]
- Display product attributes for current product
- Div Missing In Custom Loop Query
- Using page template to fetch posts in page
- rewrite_rule – working fine but broken for pagination
- Create Customization Controls from Array
- ACF loop and php formatting
- How to have post count after each listed category
- How can I put a custom field as the link of a button shortcode?
- Transient Loop Not working as expected
- How can i list all user registered on my website and have pagination [duplicate]
- Custom Meta Box If Else Statement
- Conditional in foreach loop is outputting content twice
- Alternative loop syntax error [closed]
- is there away to hide php code in wordpress not to show in PAGES
- How to add pagination for wordpress home page
- Pagination 404 on my index.php
- paginate_links() returns NULL instead of the pagination links, but pagination is actually happening
- Blog Posts not sorted and pagination not adjusted after filtering some category
- Count the number of matching post names in foreach loop
- Why do I get a 404 error on my custom post type archive pagination?
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress