Get the current WordPress page number
WordPress as you probably already know is a very powerful content publishing platform and is used by hundreds of thousands of people all over the world.
Despite all of the great things which you can do with WordPress out of the box there are a few things missing, one of which is getting the current page number. For WordPress theme designers or those who just want to add a little customization to their WordPress themes this can be a very handy feature – it lets you find out the current page number.
Finding the current page number in WordPress consists of just a single line of code so it’s super easy. And here it is.
$pageNumber = (get_query_var('paged')) ? get_query_var('paged') : 1;
This will get the current page number and store it into the $pageNumber variable. Then you can do whatever you like with it. Simple!