Unlimited WordPress themes, graphics, videos & courses! Unlimited asset downloads! From $16.50/m
by
Lessons:7Length:39 minutes
Custom post types in wordpress 400x277
  • Overview
  • Transcript

4.1 Conclusion

Let's wrap things up by recapping what was covered in this course and what you have learned.

4.1 Conclusion

Hello and welcome back to this Tuts+] course on using custom post types in WordPress. In this part of the course, I'm gonna wrap up and show you what you've learned during the course as a summary. The first thing that you learned to do was register your post type, which was Project. So you'll have noticed when you did it, that Projects appeared over here in the side bar in your admin screens. And when we registered it, we included the Categories and Tags taxonomies. So those are displayed, as well. So we used the register post type function here with our arguments and our labels which we set up. And then we save that in a plugin file which we then activate it on the site to create those post types. We then moved on to adding Projects to our main blog page. So we used the pre_get_posts hook to do that and that was done in the functions file in our child theme. Now if you're working with your own theme, you can do that in the functions file in your main theme. So we use pre_get_posts here to add the totsplus_project post type as well as normal posts to our home page. The next thing we did was look at template files. So firstly, we created a single template file to display single posts. Which we created by editing the single file from our parent theme. We also created a loop file, which we called using the get_template_part function here. And in that loop, we made some edits to display our projects. And then finally, we created an archive template file. Specifically to display posts from our custom post type. And we added that to the navigation menu in our site as well, so they can all be displayed on one easy to find page. So that's how you add custom post types in WordPress and display them on your site. I hope you found this course useful. Thanks for watching

Back to the top