Allow Static Page Load Dynamic Child Pages

I am new to WordPress — extreme wet behind the ears as you call it.

Using these forums I walked my way through creating my own blank theme and custom templates.

I am looking to take one of those pages with custom template one step further which is allow this page to have child pages.

I don’t want to create these pages; I am looking to make this page dynamic rather than adding static pages. Something along the following.

domain.com/parent/ — Parent Page with Custom Template

domain.com/parent/child1/ — Child Page

domain.com/parent/child2/ — Child Page

domain.com/parent/child2/page/1/ — Child Page with Pagination

As of right now; I have the Parent Page created with a Custom Template. When I load this page and enter a child after it as in above, I get a 404 error.

I could manually create these child pages and that would work. Except I don’t want to make this static, I want all those pages afterwards rewrite dynamically.

I read on here about creating Custom Post Types. Which did solve all my other issues, just not this one. This is what I have in place.

function custom_post_types() {
$args = array(
‘has_archive’ => false,
‘rewrite’ => array(
‘slug’ => ‘parent’,
‘with_front’ => false,
‘pages’ => true
));
register_post_type(‘parent’, $args);
}
add_action(‘init’, ‘custom_post_types’);

Where to I go to read up on making this page load dynamic child pages?

Read more here:: Allow Static Page Load Dynamic Child Pages

Leave a Reply

Your email address will not be published. Required fields are marked *