Alex Rivera | Logout

Finding current page number in Wordpress

Asked 2009-06-23T09:02:51.833
21

I have added the following custom loop in my Wordpress template:

$args = array(
    'category__not_in' => array($featured_cat->term_id),
    'posts_per_page' => 10,
    'post__not_in' => array($recent_post)
);
query_posts($args);

For pagination to work, I guess I need to pass another arg paged with the current page number. What is the way to get the current page number in Wordpress?

Edit
Report

3 Answers

18

using variable $paged.

global $paged;
echo $paged;
answered 2013-08-05T10:45:32.237
6

For 'Page x of y' I use this:

<?php 

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
echo $paged.' of '.$wp_query->max_num_pages; 

?>
answered 2013-02-20T12:44:23.210
3

This worked for me:

<?php echo '(Page '.$page.' of '.$wp_query->max_num_pages.')'; ?>
answered 2013-02-06T23:41:28.230

Your Answer