Title: Child Page Conditional
Last modified: August 20, 2016

---

# Child Page Conditional

 *  Resolved [joshrodgers](https://wordpress.org/support/users/joshrodgers/)
 * (@joshrodgers)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/child-page-conditional/)
 * I have a parent page and some child pages – example: my parent page is “people”
   and my child pages are “billy”, “tom”, and “phil”. I am looking for a conditional
   statement that I can write so `if` we’re on page “tom” and only on page “tom”
   do “something”, `if` not do “something else”.
 * I thought this would work: [http://pastebin.com/DSMhPi0f](http://pastebin.com/DSMhPi0f)
 * But this code displays “something” on all child pages, not just on child page“
   tom”.
 * Any ideas?
    Thanks, Josh

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 3 months ago](https://wordpress.org/support/topic/child-page-conditional/#post-3426148)
 * Check Codex’ function reference [http://codex.wordpress.org/Function_Reference/](http://codex.wordpress.org/Function_Reference/)
   
   Where did you get `is_child` from?
 *  Thread Starter [joshrodgers](https://wordpress.org/support/users/joshrodgers/)
 * (@joshrodgers)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/child-page-conditional/#post-3426150)
 * Andrew,
 * Sorry about that…this is in my functions file: [http://pastebin.com/SKyi1hWh](http://pastebin.com/SKyi1hWh).
 * Thanks,
    Josh
 *  Thread Starter [joshrodgers](https://wordpress.org/support/users/joshrodgers/)
 * (@joshrodgers)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/child-page-conditional/#post-3426292)
 * I don’t know what I was thinking earlier…I guess somehow I was thinking that `
   is_page` wouldn’t work for my child page, but I was over-thinking…this is my 
   final code:
 *  `<?php if (is_page("tom")) {`
    `echo "do something";` `} else {` `echo "something
   else";` `} ?>`
 * I know, I know it’s so simple, but it works – guess I was just having a brain
   fart.
 * Thanks,
    Josh

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Child Page Conditional’ is closed to new replies.

## Tags

 * [child](https://wordpress.org/support/topic-tag/child/)
 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [page](https://wordpress.org/support/topic-tag/page/)
 * [parent](https://wordpress.org/support/topic-tag/parent/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [joshrodgers](https://wordpress.org/support/users/joshrodgers/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/child-page-conditional/#post-3426292)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
