Custom project types for your portfolio

By Kieran Hunter

You know how you have categories for posts? well this tutorial shows you how to add project types to your portfolio. Project types are essentially just another word for category. You can then add the project type slug as a class in the body tag.

For instance I post illustrations and design work etc to my portfolio, I can then assign each post (project) to a project type. Such as ‘design’, ‘illustration’, ‘web design’, ‘logo’ etc.

Custom post types for WordPress

The point in doing this is that I can then assign the project type name, for example ‘web design’ as a class in the body tag.

I can then target all my portfolio items in the ‘web design’ post type and style them differently to all the rest.

Below will add the options for you to add your own list of project types. Add this into your functions.php. The second part of the code will then add the 'slug' of the project type as a class name in the body tag of the post type.

Remember change ‘portfolio’ to whatever your custom post type is called.

PHP

You should now be able to add project types (categories) to your custom post type. As well as that you will see the name of that project type as a class inside your body tag, so that you can target it.

Please let me know how if this helped, and if you have any questions, just leave a comment below, or share it thanks.

Leave a comment