Codex tools: Log in
Languages: English • Italiano • (Add your language)
Contents |
Retrieve variable in the WP_Query class of the global $wp_query object.
<?php get_query_var( $var ) ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<h1>Currently Browsing Page <?php echo $paged; ?></h1>
For getting the current pagination number on a static front page (Page template) you have to use the 'page' query variable:
<?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?>
<h1>Currently Browsing Page <?php echo $paged; ?> On a static front page</h1>
Note: The query variable 'page' holds the pagenumber for a single paginated Post or Page that includes the <!--nextpage--> Quicktag in the post content.
Since: 1.5.0
get_query_var() is located in wp-includes/query.php.