$page->index() method

Return the index/position of this page relative to siblings.

If given a hidden or unpublished page, that page would not usually be part of the group of siblings. As a result, such pages will return what the value would be if they were visible (as of 3.0.121). This may overlap with the index of other pages, since indexes are relative to visible pages, unless you specify an include mode (see next paragraph).

If you want this method to include hidden/unpublished pages as part of the index numbers, then specify boolean true for the $selector argument (which implies "include=all") OR specify a selector of "include=hidden", "include=unpublished" or "include=all".

Available since version 3.0.24.


$i = $page->index();
$n = $page->parent->numChildren();
echo "This page is $i out of $n total pages";


// basic usage
$int = $page->index();

// usage with all arguments
$int = $page->index($selector = '');


selector (optional)

Return value


Returns index number (zero-based)

$page methods and properties

API reference based on ProcessWire core version 3.0.148

Twitter updates

  • This week we’ve got a couple of really useful API-side improvements to the core in 3.0.151, including predefined image settings and static language translation improvements— More
    21 February 2020
  • New post in the blog about all the fun we had driving around a DDOS attack on our forums, how we got it back under control, and what we learned along the way. Plus PW 3.0.150 dev details and links! More
    7 February 2020
  • New post: ProcessWire core updates (January 31, 2020)— More
    31 January 2020

Latest news

  • ProcessWire Weekly #302
    In the 302nd issue of ProcessWire Weekly we're going to dig into ProcessWire 3.0.151, introduce a new third party module called PrivacyWire, and showcase some interesting ProcessWire highlights from the past week or so. Read on!
    Weekly.pw / 22 February 2020
  • ProcessWire 3.0.151 core updates
    Blog / 21 February 2020
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani