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.

I'm creating a post type for a site where there 4 main 'parent' pages in a custom post type. For the sake of argument the post type is 'schools'

the 4 (of many) parents are:

Cambridge Teesside Newcastle Sunderland

The post type 'schools' is a hierarchical post type, and what I would like to do is treat any children of the top 4 pages as a blogroll in the individual pages. To do this I would like to add a custom menu item on the post type menu that looks something like this

edit.php?post_type=schools&parent=123

Is this possible? If not, does anyone know of another way I can achieve this?

Cheers

share|improve this question
    
Have you found a solution for this yet? –  Brian Fegter Sep 16 '12 at 4:16
    
No, I am still looking around. I think I will have to add a hook to the post_save hook (or the hook that is called when a post is saved) that does it manually depending on a variable passed. I couldnt find any query like above that provided what I needed. I'll be sure to update here if I find a solution. It's very useful if you are using Wordpress as a CMS and are using hierarchical pages/posts. –  Brad Morris Sep 17 '12 at 20:48

1 Answer 1

If you are using just using 4 posts, I think that schools would better be suited as taxonomy terms rather than a post type. Associate your Posts with the school tax term. I would then create custom templates for each of those terms.

  • taxonomy-schools-cambridge.php
  • taxonomy-schools-teeside.php
  • taxonomy-schools-newcastle.php
  • taxonomy-schools-sunderland.php

Within those templates, use a WP_Query object to surface those posts. Read more about WP_Query taxonomy parameters here.

Your URLs would still be /schools/sunderland/ etc...

This seems like an easier out-of-the-box approach rather than creating new functions to do the same thing. Though, this comes down to UI preference at the end of the day.

share|improve this answer
    
Sorry for not replying earlier. There is a few issues with this answer (Although I appreciate the time, and I also appreciate my op wasnt too specific!). There could have any number of parents, hence creating a manual taxonomy template for each parent would be unwieldy. This would work perfectly if the number of parents was specific. –  Brad Morris Sep 17 '12 at 21:02

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.