Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wordpress pagination get current page number from url

Tags:

wordpress

I need to extract the value of "page" i.e 5 from this url - http://snypher.local/photos/page/5 What should I do to extract it in Wordpress? I am not able to get it from the $_GET super global.

like image 891
Samik Chattopadhyay Avatar asked Nov 26 '11 20:11

Samik Chattopadhyay


1 Answers

its work fine i've tested on my current WP (version 3.5.1)

$current_page = max( 1, get_query_var('paged') );
$total_pages = $wp_query->max_num_pages;
echo 'Page '.$current_page.' of '.$total_pages;

Result = Page 3 of 51

like image 110
Rameez SOOMRO Avatar answered Sep 21 '22 16:09

Rameez SOOMRO