Finding current page number in Wordpress


Question

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?

1
18
11/1/2012 2:57:15 PM

Accepted Answer

Not near a wordpress system to test this out at the mo, but you should be able to use:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

(obviously defaulting to 1, if it has not been sent through).

62
6/23/2009 2:00:08 PM

using variable $paged.

global $paged;
echo $paged;

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon