Emerald Coast WordPress Meetup presentation slides.
Firestorm Creative Studios explains how using custom post types in WordPress can help you better organize and structure your content and by using a simple plugin, you can also for relationships between post types. When creating content assets on your website, be sure that you offer the best user experience possible so that your content marketing efforts get the maximum benefit. Better and more logical content organization also allows search engines to better interpret what your content pages are about and reward you with better search relevance and rankings.
www.Firestormcs.com
top marketing posters - Fresh Spar Technologies - Manojkumar C
WordPress custom posts types for structured content
1. Custom Post Types
F o r m o r e s t r u c t u r e d c o n t e n t i n W o r d P r e s s
2. Introduction
Custom post types allow you to make WordPress a much more flexible and feature
rich content management system. In this meetup we’ll discuss how to setup,
customize, organize and implement multiple custom post types into your website or
project, and then connect them together to handle different types of content in a more
structured and effective way.
3. 3
What We’ll (try) to Cover
Here’s a quick rundown of what I hope we can talk about in the time we have
• The basics: What is a custom post type?
• WordPress default Post types
• Why would you need a custom post type for your site?
• Examples of custom post types and where they are
used
• How to create a custom post types and taxonomies for
your site
• How to display your custom post types in your theme
• How and Why to connect multiple custom post types
together
• Code samples and how to use them in your theme
• Custom post types resources and links to get started or
learn more
• Q & A
4. 4
What is a custom post type?
Custom post types extend wordpress to add functionality beyond the default post types
A custom post type is just a “post” with a different “post_type”
value saved in the database.
• WordPress added custom post types to the core in version 3.0.
• Standard posts (blog posts) have a post type of “post”.
• Standard Pages have a post type of “page”.
• Your custom post type can be whatever you want
• For example: “Staff”, “Portfolio”, etc…
• Custom post types show up as separate menu items
• Can have their own categories and tags (taxonomies) and can act
like a post or a page
• Can have all, some or none of the standard features
• Can use custom loops to call this content anywhere in your theme
5. 5
Default WordPress Post Types
Here’s what you get out of the box
Posts (Post Type: 'post')1
Pages (Post Type: ‘page')2
Navigation Menus (Post Type: 'nav_menu_item')3
Attachments (Post Type: ‘attachment')4
Revision (Post Type: ‘revision')5
6. 6
Why would you need a custom post type?
Why go through the trouble of using custom post types at all?
Flexible Content Management
Custom Data Fields
Better Content Structure
Be Searchable
If your content needs to be displayed differently than a standard post or page you
can create custom page layouts for each content type (i.e., unique layout)1
If you need more fields to manage all the information for a specific type of content
on your website (i.e., house amenities, car features, etc)2
If you want your content to have it’s own unique URL (permalink) structure separate
from posts and pages. For example “www.mydomain.com/staff/jimmy-john/”3
To more easily manage your content in the WordPress admin. Each custom post
type has it’s own tab and edit screens to keep things organized4
7. 7
Post Type Example
North Okaloosa Physicians Group – Physicians Custom Post Type Archive Listing (template-physicians.php)
Here we used a custom post type “Physician” to
organize and display all the physicians in a
custom designed archive or “list” page
Custom Archive Page
Custom Query & Loop to display
Custom Page Template
Custom Search Based On Post Type
Can expand the content in the future
8. 8
Post Type Example
North Okaloosa Physicians Group – Physicians Custom Post Type Detail Page (single-physician.php)
Custom post type “Physician” single page. Each
physician has a detailed bio page. Which also
brings in data from connected “specialties”
Custom Detail Page
Custom Query & Loop to display
Unique Layout Display
Custom Meta Fields
Easily edited should info change
9. 9
Post Type Example
North Okaloosa Physicians Group – Physicians Custom Post Type Edit Screen
Custom “Physician” edit screen in WP admin has
multiple custom fields and meta boxes to
complete a detailed profile of each physician.
Custom Edit Screen
Custom Meta Boxes and Data Fields
Connected “Specialty” post type
Custom Taxonomy
Easily Expand Data Fields & connections
10. How do you
add a CPT?
Now let’s looks at the code and plugins
that allow you to add your own custom
post types (CPT) and custom
taxonomies
11. 11
Create Custom Post Types
Custom post types should ideally be placed in a plugin, but they don’t have to be
1. Use a custom plugin to hold your post type code 2. Use plugins to manage and create your post types
12. Using a Custom
Plugin
Code your own plugin to handle your
custom post types and taxonomonies so
you can reuse it elsewhere or easily
change your theme.
13. 13
Creating a Basic Plugin
Create a file called posttypes.php and add this code
14. 14
Creating a Basic Custom Post Type
Minimal code to register a custom post type
25. 25
Custom Post Type Resources
Links and additional resources if you want to go deeper into it
WordPress Codex CPT https://codex.wordpress.org/Post_Types
Custom Post Type UI Plugin
https://wordpress.org/plugins/custom-post-type-ui/
Advanced Custom Fields
https://wordpress.org/plugins/advanced-custom-fields/
Smashing Magazine Custom Post Type Article (2015)
http://www.smashingmagazine.com/2015/04/extending-wordpress-custom-content-
types/
Design Wall Custom Post Type Article (2014)
http://www.designwall.com/blog/use-custom-post-types-taxonomies-make-wordpress-
even-useful/
26.
27. Thanks for Watching
Do you have any questions or awesomeness you’d like to share?
www.firestormcs.com cecil@firestormcs.com @firestormcs /FirestormCreativeStudios
Stay in touch: