Handling multiple post type templates: Consolidating everything in one file


show more Handling multiple post type templates: Consolidating everything in one file provides you with in-depth training on Design. Taught by Morten Rand-Hendriksen as part of the Create an Online Portfolio with WordPress show less
please wait ...

Handling multiple post type templates: Consolidating everything in one file

In the last movie, we created three custom posts type templates, one for each of our custom posts types. However, as you can see, most of the content in each of our custom posts type templates is exactly the same. The only thing that really changes is where the taxonomy information appears and the conditional statements around it. So wouldn't it make more sense to make just one file that had all the template information and then just reference that file from outside, so that it applies to each of the custom posts types? That would mean we had one file that we could edit, rather than three.

So that's what we're going to do. Just so there is no confusion, I've reset the theme back to where it was at the end of the third movie of this chapter. That means we only have one file here called content-recipes, and the other ones are gone. So we'll start off by opening that file and resave it as custom-content.php. The reason I'm resaving it is just so I don't have to copy...

Handling multiple post type templates: Consolidating everything in one file
Video duration: 6m 21s 3h 13m Advanced

Viewers:

Handling multiple post type templates: Consolidating everything in one file provides you with in-depth training on Design. Taught by Morten Rand-Hendriksen as part of the Create an Online Portfolio with WordPress

Subjects:
Design Web
Software:
WordPress
Author:
please wait ...