If you want max_num_pages, you need to use WP_Query instead of get_posts. You can then use $your_query_object->max_num_pages in your code.
offset and paged don’t work together, because both of them ultimately set LIMIT in the MySQL query. offset query parameter will always override paged. If you want to offset the results, you need to do the math yourself, multiply page number by posts per page and add offset, and then only use offset. See Making Custom Queries using Offset and Pagination for more info.
Related Posts:
- Category Attachment Pagination 404 Error on 2nd Page
- How to manually fix the WordPress gallery code using PHP in functions.php?
- Only get_posts of certain post formats
- Modify previous and next text from pagination links
- Is the first item returned by get_posts() always the latest post?
- Getting paginate_links() ‘end_size’ to display none
- WordPress AJAX Pagination with query_posts
- How to draw media details for Isotope gallery using Photoswipe
- How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
- Static Frontpage Pagination – Custom loop
- Why can I not use setup_postdata($post) in the sidebar?
- I can’t fetch query parameters ($_GET parameters) with get_query_var
- How to retrieve a value from get_posts()? [closed]
- PHP/Manual use of images? – 2 Questions
- Rewriting search and pagination base
- Limit number of pages in pagination
- Getting movie and serial on actor page
- WooCommerce – Customer Order History Pagination
- Changing Link Attributes for Wp_Link_Pages
- Custom Loop Pagination on WordPress
- Edit format of Paginate_Links()
- how to display active, upcoming and past event with featured listing with pagination
- Adding Image Count to Multigallery
- Pagenavi pagination via wp-query in functions.php showing same content for each page
- Get a Page’s attachments in Gallery order
- How to check if comments are paginated?
- Display 4 chronological posts starting with a random post
- get understrap pagination to work with custom query
- Using an Image Slider twice on the same page
- How do I output a database option that is an array into a get_posts array?
- Customized title tag for each page in pagination?
- Add “last” and “first” to WordPress Comment Pagination Links
- How to return output of the new wp gallery block for automatically Link images To Media file
- WordPress get pagination on wpdb get_results
- Sorting Posts | Alphabetical Order
- Getting rid of role=”navigation” in the Home Page Pagination
- Page navigation not showing even tho it should
- Advanced Custom Fields: Post Object – Not returning data [closed]
- How to get the Page Number of the Current Page in Single Post Pagination
- How can I add pagination and how can I change thumbnail size?
- Add a class to the anchor tag on HTML5 gallery
- WP-PageNavi is showing the first page only
- Why not yield/iterable in posts interface?
- How can I properly control the numbers and dots that appear in pagination?
- Increase returned number/pages on pagination
- Adding nofollow to a PHP generated Nav
- Using loop pagination on single.php
- Showing a different gallery in a seperate post
- Logged in user ID as post ID
- WordPress 3.2 query_posts and pagination, permalinks issue
- Create own WordPress shortcode gallery
- Unreadable pagination
- How do I exclude recent post from recent post php widget
- How to show all pages in blog navigation?
- get_terms pagination
- How to get next image with this code from same post?
- Upload multiple images to a Woocomerce product
- Following/Followers Users list Using Ajax Pagination inside Author Profile
- WordPress Single Post Pagination Numbered and Navigational
- Exclude a category slug on pagination
- How to generate customized filtered output for the gallery
- How to display post_content from database in different on template page?
- Add a leading zero to pagination
- Displaying POST content with HTML tags and all
- Get current_post in reverse order with pagination
- Apply filters when loading post via ajax
- Create a hierarchical loop at predefined markup requirements
- Using catch_that_image() for galleries?
- rewrite_rule – working fine but broken for pagination
- Even with PHP plugin get_posts not working in widget area
- How to fix blank pagination links?
- Need help with get_posts pagination
- WordPress pagination broken on blog page, working for search results page
- Sort posts by title, sort array by largest number [duplicate]
- Creating image gallery in wordpress
- Dynamic Gallery
- Pagination on Custom Loop
- Gallery requires a featured image but does not show it in posts/pages
- Transient Loop Not working as expected
- show/hide attachments
- How can i list all user registered on my website and have pagination [duplicate]
- Pagination not displaying
- WordPress post pagination on custom template not working
- Pagination in category.php not functioning
- How to add pagination for wordpress home page
- Pagination 404 on my index.php
- Infinite Scroll Plugin: How to first show 6 posts and then 2 posts thereafter with Infinite Scroll Plugin?
- Pagination not working properly
- paginate_links() returns NULL instead of the pagination links, but pagination is actually happening
- What does this if-statement do?: if($pages=’ ‘) {}
- Blog Posts not sorted and pagination not adjusted after filtering some category
- How to Set Page Pagination Using Ajax JQuery – WordPress
- Find owner of coupon
- /page/2/ redirect to 404
- Link on post title only if post have content
- Why do I get a 404 error on my custom post type archive pagination?
- Adding a css class to the gallery
- Custom post type removing /page/2/ from URL when trying to access it
- Pagination with WP_query giving same items in each page
- How to make posts_like_dislike reference current post when iterating?