Apologies, but I’m new to the world of composer since moving up to Sage 9. I realise I’m probably missing something fundamental here, but I’m struggling to figure out how to use the PostTypes class.
I have done a
composer require jjgrainger/posttypes in the Bedrock directory, so that the class is apparently available, but if I want to create some post types from within the Sage 9 theme (I know - they should be in plugins, but for my needs they fit perfectly well within the theme) where should I create the file and how do I get it picked up by wordpress?
According to the PostTypes docs I have the following in a file called
require __DIR__ . '/vendor/autoload.php'; use PostTypes\PostType; $books = new PostType('book'); $books->register();
Where in the Sage hierarchy should I put it, and do I have create a reference to it somewhere?
Many thanks - this move from Sage 8 to 9 is proving to be a tough one for me!
Edit: Hang on - should I have done
composer require jjgrainger/posttypes in the Sage theme directory rather than the Bedrock directory?