Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

http://url.com/section1  
http://url.com/section2  
http://url.com/section3  

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?

share|improve this question

migrated from stackoverflow.com Dec 29 '12 at 0:47

This question came from our site for professional and enthusiast programmers.

    
What do you mean by "pages template" exactly? A page type? Pre-filled HTML? –  Pekka 웃 Dec 28 '12 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 '12 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 '12 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 '12 at 13:02

1 Answer 1

up vote 0 down vote accepted

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: http://wordpress.stackexchange.com/questions/44324/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().

share|improve this answer
    
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 '12 at 13:20
    
img547.imageshack.us/img547/4729/96056902.png –  ptimson Dec 28 '12 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 '12 at 13:33
    
Ok Ill leave this open for now then –  ptimson Dec 28 '12 at 13:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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