Show Siblings or Children of a WordPress Page

March 4, 2009 wordpress

A useful code snippet I thought I’d share

<div id="subpages">
<h3>Related Pages</h3>
// If CHILD_OF is not NULL, then this page has a parent
// Therefore, list siblings i.e. subpages of this page's parent
// If CHILD_OF is zero, this is a top level page, so list subpages only.


  1. Thanks for this! Exactly what I needed. Kudos!

  2. Janine Meyer 8 years

    thanks so much for sharing this – really handy! (should have seen this last week when i was editing a theme)

  3. Paul 8 years

    Thanks for this snippet! I had been using a piece that was more complicated to do the same thing, but this is even better.

  4. Nick 8 years

    Brilliant! Huge help! I will use this on pretty much all of my client’s WordPress sites.

Comments are closed.