Custom Post Types in WordPress
# June 28, 2013 at 4:30 pm
I’m a teacher and amateur web designer. On a school site I’ve been making in WordPress, I’ve created a Custom Post Type called Lessons. How do I get the Lesson pages to be child pages of regular pages?
I want my colleagues to be able to create Lessons and attach them to the right course units, but I want to restrict them from editing regular pages…
Your help would be appreciated! You can see what I’ve done so far at science.standhigh.info# June 29, 2013 at 3:11 pm
I asked a similar question a couple of months ago, but it turned out, that nobody could help me with it. Since then I researched on my own. I found out, that, if you are good with PHP (which I’m not), you probably can pull this off. In my case I just couldn’t get it to work, so I gave up and took another approach.
I don’t know if this will help you, but you can create an archive for your custom post type. Just create a new template file and name it **archive-“your-custom-post-type”.php** (without the quotation marks). Oh, and make sure to check *has archive* in Custom Post Type UI. You could sort the lessons with custom taxonomies there.
Or you could create a custom taxonomy for each topic and have your colleagues tag their posts with the right taxonomies. You could then link to a custom taxonomy archive for each lesson/topic (yes, this will probably be a mountain of work ;-) ).
If that doesn’t help you, here’s the PHP-way (which I couldn’t get to work, but maybe you have more luck/skill): http://www.gravitationalfx.com/how-to-set-a-page-as-the-parent-of-a-wordpress-custom-post-type/# June 29, 2013 at 3:21 pm
It might be better if you elaborate on what exactly you’re trying to do, though.# June 29, 2013 at 6:09 pm
This reply has been reported for inappropriate content.
This seems like it may not be the most logical approach. By definition pages are for static content and posts are for dynamic content. That is the distinction and that is how WordPress is set up. If I were you, I would do one of two things:
I would make the lesson posts children of catagories instead of pages. That would make more logical sense.
Your other option is just to give your colleagues the proper permissions to add/edit pages. And make them children of their proper parent page.
I definitely think that blurring the lines between pages and posts within the WordPress ecosystem is not a good idea.# June 30, 2013 at 2:43 am
@chrisburton I did exactly that, and found another way to achieve what I wanted to do.
@Joe_Temp From my understanding of wordpress’ cpt-system, a custom post type can be a page too, you just have to set **’capability_type’ => ‘page’** for that. Correct me if I’m wrong.# June 30, 2013 at 10:28 am
Thanks for the replies and ideas. I think the main problem is my lack of understanding about taxonomies…
I got my single-lessons.php template working yesterday
(apart from a repeater-field for file attachments – which I’m reasonably confident I’ll get sorted soon). So the custom taxonomy issue is the main thing I need help with…
I need my non-technical colleagues to be able to assign a lesson to a particular unit with a single click or select field. There will be about 100 different units of work in a hierarchy of up to 5 levels… So for example, a lesson could be assigned to:
Science > AS Level Physics > Unit 1 > Section 1
At the moment, I have no idea how to achieve this!
You must be logged in to reply to this topic.