Im currently working on a Theme for a WordPress website. The theme affectively splits the website up into three sections.


I need to be able to split up Pages in the backend into these sections. So in the menu it appears:

- Pages
    - Section 1
    - Section 2
    - Section 3

And when you go into the relevant section the "Add New Page" button would set the pages parent to be the corresponding section.

I realise this is very complicated,I currently have divided the menu but need to provide functions for each menu item.

Is there anyway to do this with action hooks? Or will I have to edit the core files new-post.php and edit.php?

  • What do you mean by "pages template" exactly? A page type? Pre-filled HTML?
    – Pekka
    Dec 28, 2012 at 12:24
  • Sorry I updated this, I meant "page's parent". So that if you create a new page in Section 2 the page's parent would be Section 2 so that the url would be: url.com/section2/newpage
    – ptimson
    Dec 28, 2012 at 12:55
  • Mmm, isn't this covered by WP's standard functionality already? You can assign a parent to any page. You may have to activate the field in the options at the top of the screen
    – Pekka
    Dec 28, 2012 at 12:57
  • I need this to be done with PHP so that the user cannot set the Parent. And I need to know how to divide up the pages into the relevant sections.
    – ptimson
    Dec 28, 2012 at 13:02

1 Answer 1


I need this to be done with PHP so that the user cannot set the Parent.

I asked this over on WP.SE and got a promising answer: Creating new page with pre-defined parent page I haven't got around to testing it yet, though, as the project is on hold.

And I need to know how to divide up the pages into the relevant sections.

I'm not sure what you mean by that and how deep a division you need in your project. To display the three sections, you could use wp_list_pages() three times, and use the child_of parameter to pick the right section. Or you could have three menus in the backend, and call each of them using wp_nav_menu().

  • I believe that answers my first question and I know that wp_list_pages() can be used. But I will need to display only the pages that are in section 1 with edit.php and in another case the pages that are in section 2 with edit.php. This diagram should help explain: (Will update with diagram)
    – ptimson
    Dec 28, 2012 at 13:20
  • img547.imageshack.us/img547/4729/96056902.png
    – ptimson
    Dec 28, 2012 at 13:30
  • @ptimson I see. I imagine for that to happen, you'll have to dig deep into the code, no idea how feasible that is. One idea that comes to mind is misusing the custom post types concept - with those, you can get separate menu items in the back-end. But I don't know post types well enough to tell what other problems you'd probably encounter on your way.
    – Pekka
    Dec 28, 2012 at 13:33
  • Ok Ill leave this open for now then
    – ptimson
    Dec 28, 2012 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.