Subpage template

I’ve had a look around already but couldn’t find an answer to this.

Is there a way to create a template that applies to all pages that have a parent? something like sub-page.php without having to manually select it from the page attributes?

1 Answer
1

Just build it directly into your page.php template. e.g.:

<?php
global $post;
if ( $post->post_parent ) {
    // This is a child Page; do something
}
?>

Leave a Comment