Collections and Custom Post Types
Posts are a generic content type. They can be used for blog posts, news articles, or any other type of content that is made up of a title, body, and other fields. Unlike content attached directly to pages (such as a hero image), posts are typically shown in lists (such as the latest news) and accessed dynamically.
Collections provide a blueprint for creating and managing posts. For example, you may wish to create a collection of movies. The collection has a schema that defines which fields are used for each movie such as Title, Director, Year of Release, and so on.
Creating Custom Post Types
Textstem provides a convenient Artisan command to generate new collections quickly. Run the following command to make a new Venue collection:
php artisan textstem:make:collection venue
This will generate two new files in your project
- views/wrangler/posts/venue/schema.json
- views/wrangler/posts/venue/config.json
If you include the --wc flag, it will also make a component to display this new collection and these additional files will be created:
- app/Wrangler/Components/Venue.php
- views/wrangler/components/venue/view/default.blade.php
- views/wrangler/components/venue/list/default.blade.php
Content Packs
Content packs are zip files containing
- custom schema
- configuration
- any custom components to displaying the custom posts