Roots Discourse

How I use PostTypes to make Post Types

#1

Hi,
This is in response to a specific message I received, but I thought the info might be useful enough to post publicly.

I use PostTypes to create custom post types for most of my projects. I tend to go overboard with “doing things the right way”, so I usually make a separate plugin for each custom post type which includes its post type definition, custom fields, and even templates with Gamajo Template Loader.

But the simplest example of this is a basic post type as a plugin, pulling PostTypes in as a dependency via composer, so I made an example repo here:

You definitely shouldn’t fork this repo. It’s meant as an example only, but it should be pretty easy to follow for making your own.

Once you’ve made your own plugin you can include it in Trellis either by adding it to Packagist, or by using this method.

6 Likes

#2

This was exactly what I was looking for, @MWDelaney; thanks for taking the time to put this together. I appreciate it!

0 Likes