paged

The paged global variable stores the current page number in the pagination, usually of WordPress archives. It is a query string variable and is set in [wordpress root folder]/wp-includes/template-functions-links.php] if it is not explicitly set.

WordPress theme authors need not use this global variable directly, following functions are provided to support pagination:

  • next_posts_link($label='Next Page »', $max_page = 0): displays link for posts later in the order
  • previous_posts_link($label='« Previous Page', $max_page = 0): displays link for posts before the currently displayed posts in the order
  • posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »'): displays both the next and previous post links

These functions refer to the next and previous page in the set of archives. These functions can be used in themes to provide links for navigation within the archives. The archives are displayed in multiple scenarios – the usual index, search, month-wise archive, category-wise archive – for that matter any cohesive set for displaying posts together. You can choose to display posts alphabetically instead of chronologically as mentioned in this WordPress codex document.

$max_num_pages is used to determine the total number of pages in the archive.

Back to full list of global variables.

Technorati tags: , , ,

Copyright Abhijit Nadgouda.

Advertisements

2 Responses to “paged”

  1. Abhijit Nadgouda @ iface » max_num_pages Says:

    […] max_num_pages represents the number of pages when any WordPress archive is displayed. It is set using the posts_per_page global variable. It is calculated and set in the functions next_posts_link($label=’Next Page »’, $max_page = 0) and posts_nav_link($sep=’ — ‘, $prelabel=’« Previous Page’, $nxtlabel=’Next Page »’) defined in [wordpress root folder]/wp-includes/template-functions-links.php. […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: