WordPress List Pages Template Tag - dummies

By Lisa Sabin-Wilson

The <?php wp_list_pages(); ?> tag displays a list of the static pages, such as About Me or Contact, that you can create on your WordPress site. Displaying links to the static pages allows readers to click the links and read the content you’ve provided.

WordPress has a handy Custom Menus feature. If you like the navigation tool, you may never need to use the wp_list_pages(); template tag. You may want to use this tag if you want complete control over how the list of pages appears on your website.

This tag uses the string style parameters. Here are the most common parameters used for the wp_list_pages(); template tag.

Parameter Type Description and Values
child_of Integer Displays only the subpages of the page (pages with a parent
page set in the Page Attributes section of the Edit Page page on
your Dashboard); uses the numeric ID for a page as the value.
Defaults to 0 (display all pages).
exclude String Lists the numeric page ID numbers, separated by commas, that
you want to exclude from the page list display (for example,
‘exclude=10, 20, 30’). There is no default value.
sort_column String Sorts pages with one of the following options: ‘post_title’ sorts alphabetically by page title
(default). ‘menu_order’ sorts by
page order. ‘post_date’ sorts by the date
the pages were created. ‘post_modified’
sorts by the time when the page was last modified. ‘post_author’ sorts by author, according to the
author ID #. ‘post_name’ sorts
alphabetically by the post slug.
depth Integer Uses a numeric value for how many levels of pages appear in the
list of pages. Possible options: 0
displays all pages, including main and subpages (default). –1 shows subpages but doesn’t
indent them in the list display. 1 shows
only main pages, no subpages.
show_date String Displays the date when the page was created or last modified.
Possible options: ‘ ‘ displays no date
(default). ‘modified’ displays the date
when the page was last modified. ‘created’ displays the date when the page was
date_format String Sets the format of the date to be displayed. Defaults to the
date format configured in the Options tab and General subtab of the
title_li String Types text for the heading of the page list. Defaults to
display the text: “Pages”. If the value is empty (”), no heading
appears; for example, ‘title_li=My
displays the heading my Pages above the page

Page lists appear in an unordered list (or bulleted list). Whichever term you use, an unordered list is a list with a bullet point in front of every page link.

The following tag and query string displays a list of pages without the text heading Pages. In other words, this tag displays no title at the top of the page’s link list:

<?php wp_list_pages('title_li='); ?>

The following tag and query string displays the list of pages sorted by the date when they were created; the date also appears along with the page name:

<?php wp_list_pages('sort_column=post_date&show_date='created'); ?>

Take a look at the way query-string parameters are written:


The entire string is surrounded by single quotation marks, and there is no white space within the query string. Each parameter is joined to its value by the = character. When you use multiple parameters/values, separate them with the & character. You can think of the string like this: parameter1=valueANDparameter2=valueANDparameter3=value.