ifacethoughts

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.

Discussion [Participate or Link]

  1. Abhijit Nadgouda @ iface » Blog Archive » Wordpress Global Variables said:

    […] $paged […]

  2. Abhijit Nadgouda @ iface » max_num_pages said:

    […] 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. […]

  3. Wordpress Global Variables | iface thoughts said:

    […] $paged […]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.