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?

  • I assume you have read through the relevant parts of the documentaion/codex and the Theme Developers Handbook correct? If not, you should, there is a lot of helpful information there. If you have, could you clarify what you mean a bit more? When you say " manually create these child pages" do you mean in the wp-admin or PHP template files? – DaveLak Jul 13 '18 at 23:22
  • Yes, I have read that. I tried a few suggestions and not getting what I need. I right now reading I may have to create a custom rewrite. Basically what I am looking for is the following > option to add multiple childs under the parent like this. /parent/child2/page/1/ those childs do not need to be databased or search able. – Top Results Jul 13 '18 at 23:29
  • On the child page in the wp-admin editor, have you gone to the "Page Attributes" meta-box on the right side and selected the proper parent from the drop-down? Or are you not able to because you are trying to relate two different post types? – DaveLak Jul 13 '18 at 23:48
  • I might not be describing this right. What you are referring to is adding another static page manually and selecting it as a child to the parent — I have the parent page created. I want to be able to include extra directory parameters off that parent page URL. Something like the following > /parent/unlimited/directories/after/the/parent/page/ and it always load the parent page I created giving me access to do what I need to using PHP to code my own custom scripting. I don’t need this searchable within WordPress, just need it dynamic driven. – Top Results Jul 14 '18 at 12:25
  • Right now with this parent page created, I am able to enter the following paths /parent/2/, parent/3/, I am not able to enter anything else except numeric values. I like to have an unlimited REQUEST_URI off that parent if possible. – Top Results Jul 14 '18 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.