You can get the current page number by get_guery_var('paged')
If it doesn’t return value, it is 1’st page.
To get the number of total pages, you need to get the total number of posts and divide by the number of per_page. Or you can simply use max_num_pages
of $wp_query object.
Related Posts:
- Newer/Older posts links display same posts on every page
- Display “Post 2 of 4” on single post page?
- How to display data with pagaination on backend?
- Pagination not working with custom loop
- Hook for post and page load
- wp_pagenavi() with custom wp_query()?
- Custom Post Type Pagination Not Working On Archive Page
- Custom Post Type Archive Page: Set Posts Per Page, Paginate
- Archive page…limiting posts per page
- Custom Posts on Different Pages
- Pagination go to first page if i’m on last post
- Posts in Multiple Columns and Rows with one single loop
- Pagination with custom loop
- How do I write this SQL statement for Posts written in last 24 hours?
- How to show related posts by category or custom post type?
- Fix custom query pagination without changing site-wide posts-per-page settings
- Pagination with custom post types results in 404 issues
- IF statement in a do_shortcode
- Making pages also serve as taxonomies? Or give full pages to taxonomies?
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- get_template_part for custom post type content not working
- Loop on front-page.php
- Trying to edit the single page from a Custom Post
- How to get all posts except for one post from a certain custom post type?
- Page vs Custom Post Types Differences/Issues
- How to display all posts from standard posts to custom post types in a loop with pagination?
- I would like to have different styles for my posts based on the content of each post
- Allow non-logged in users to see a future post after clicking on a list of future posts
- List custom taxonomy specific to one custom post type
- Paging doesn’t work?
- No Permission to add new Page, Post or CPT with Admin role
- Shortcode not working with post counter
- Custom Theme With Custom Loops
- Custom Post Types strange pagination problem
- pagination not working for category.php (custom post types in categories)
- Conditional for a Single Post That Belongs to a Category?
- How to include custom post type posts on a page?
- Including link to custom post type in ‘wp_list_pages’ function
- Pagination Error : Duplicate argument being outputted
- Multiple pages per post (not pagination)
- Can I change my post type to anything and my site still work?
- Display an authors post on a single page only when they are logged in
- WP_Query with custom post type ID
- display posts of custom post type with custom taxonomy
- Get post format
- Custom wordpress loop
- How to set the mainpage of a custom post type?
- displaying content of custom post type
- Posts are not rendering perfectly [closed]
- Render a Post or Page using the correct file
- Display post from custom post type
- Use post in multiple places on a page with multiple posts
- The loop does not show users
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Am I mixing up the concept of posts pages and categories?
- How to setup different permlalinks for posts and pages?
- Pagination for normal (standard) posts on a page with a custom loop?
- Does “Custom Post Type” can have page hierarhy option?
- If/Else child list for Custom Post Type single template within loop?
- Custom post type pagination error
- Custom archive page for custom taxonomy and pagination issue
- Custom post type paging return home page
- Pagination not working in custom post type. Help
- Pagination Not Working When Used With WP_Query() `offset` Property
- SEARCH QUERIES – REVERSE OUTPUT
- Cannot save pages after migration
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- subtracting the current post form then whole loop, which is generating all CPT titles
- User Archive page for Custom Post Type – Pagination Issue
- Display title of all custom posts from same taxonomy term on a custom post template
- Use WP pagination functions on a custom page template
- Custom post Query and WordPress Post Query Clash
- next_posts_link() always generates second page link on custom post type
- Posts are not showing up on next page.
- 2 custom posts types, in their own columns, one pagination for both
- Only show current category post
- WordPress Contents Migration
- One Post with different content, depending on a Page
- How To Loop Through list with Custom Post Types
- How to Fix Custom WordPress Loop with Pagination on Single Post View?
- Cannot use pages created on WP
- Different post types arranged on one page
- Pagination on custom post types
- Pagination in custom post type page template
- Custom post type archive pagination with HTML5Blank theme?
- How to create content automatically when a post is published?
- How to Associate Posts with Pages
- Pagination not working with custom loop
- Why are my wp urls showing page not found?
- Pagination not working with custom loop
- Pagination not working with custom loop
- Pagination not working with custom loop
- Pagination not working with custom loop
- Pulling in a particular post into a single page based on the post id passed into the code
- Styling first post using Advanced Custom Fields
- the_content() stop images being pulled through
- How do I hide single category post on my post page
- WPNavi pagination links not working on custom pages
- Two pagination in one page without AJAX