SlideShare a Scribd company logo
1 of 27
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
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
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
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
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
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
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
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
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
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
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
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
Creating a Basic Plugin
Create a file called posttypes.php and add this code
14
Creating a Basic Custom Post Type
Minimal code to register a custom post type
15
Creating Advanced Custom Post Types
Complete code to register a custom post type
16
Creating a Custom Taxonomy
Code to register a custom taxomony
Using Existing
Plugins
Using existing, supported and frequently
updated plugins is a good way to
manage your custom post types and
custom fields
18
Custom Post Type UI – Post Type
Super easy to create post types and taxonomies
19
Custom Post Type UI -Taxonomy
Super easy to create post types and taxonomies
20
Display Post Types In Your Theme
Code to display a custom post type
21
Connecting Post Types Together
Use a plugin to associate post types together to create a relationship
22
Connecting Post Types Together
create a relationship – Add the PHP and get the connections meta box on your post types
23
Connecting Post Types Together
Display connected posts in theme template file with PHP
24
Connecting Post Types Together
Display connected posts with the provided P2P widget
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/
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:

More Related Content

Similar to WordPress custom posts types for structured content

Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Evan Mullins
 
Add Custom Post Types to Your WordPress Website
Add Custom Post Types to Your WordPress WebsiteAdd Custom Post Types to Your WordPress Website
Add Custom Post Types to Your WordPress WebsiteDustin Hartzler
 
Using Custom Post Types and Advanced Custom Fields with Elementor
 Using Custom Post Types and Advanced Custom Fields with Elementor Using Custom Post Types and Advanced Custom Fields with Elementor
Using Custom Post Types and Advanced Custom Fields with ElementorAngela Bowman
 
Wordpress Custom Post Types
Wordpress Custom Post TypesWordpress Custom Post Types
Wordpress Custom Post TypesBrent Williams
 
WordPress 3 Custom Post Types
WordPress 3 Custom Post TypesWordPress 3 Custom Post Types
WordPress 3 Custom Post TypesDave Zille
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post TypesNile Flores
 
Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Stephanie Eckles
 
Custom post types - WordPress
Custom post types - WordPressCustom post types - WordPress
Custom post types - WordPresskeithdevon
 
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015Joe Querin
 
WordCamp Kent 2019 - WP 101: Custom Post Type & Custom Fields
WordCamp Kent 2019 - WP 101: Custom Post Type & Custom FieldsWordCamp Kent 2019 - WP 101: Custom Post Type & Custom Fields
WordCamp Kent 2019 - WP 101: Custom Post Type & Custom FieldsJoe Querin
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012Stephanie Leary
 
WordPress can do that?!
WordPress can do that?!WordPress can do that?!
WordPress can do that?!Scott McNulty
 
ACHLS Introduction To Blogging
ACHLS Introduction To BloggingACHLS Introduction To Blogging
ACHLS Introduction To BloggingKathryn Jones
 
WP 101 - Custom Fields & Post Types
WP 101 - Custom Fields & Post TypesWP 101 - Custom Fields & Post Types
WP 101 - Custom Fields & Post TypesJoe Querin
 
From 0 to 100 with Content types
From 0 to 100 with Content typesFrom 0 to 100 with Content types
From 0 to 100 with Content typesJoanne Klein
 
WordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenWordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenHeidi Cool
 
The very introduction to content management systems
The very introduction to content management systemsThe very introduction to content management systems
The very introduction to content management systemsSean Donnelly BA MSc QFA
 
SPS Dayton Content Types
SPS Dayton Content TypesSPS Dayton Content Types
SPS Dayton Content TypesPatrick Tucker
 
Advanced Intro to Wordpress
Advanced Intro to WordpressAdvanced Intro to Wordpress
Advanced Intro to WordpressClique Studios
 
How to Use Wordpress (for Writers and Bloggers)
How to Use Wordpress (for Writers and Bloggers)How to Use Wordpress (for Writers and Bloggers)
How to Use Wordpress (for Writers and Bloggers)Jennings Design, LLC
 

Similar to WordPress custom posts types for structured content (20)

Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
 
Add Custom Post Types to Your WordPress Website
Add Custom Post Types to Your WordPress WebsiteAdd Custom Post Types to Your WordPress Website
Add Custom Post Types to Your WordPress Website
 
Using Custom Post Types and Advanced Custom Fields with Elementor
 Using Custom Post Types and Advanced Custom Fields with Elementor Using Custom Post Types and Advanced Custom Fields with Elementor
Using Custom Post Types and Advanced Custom Fields with Elementor
 
Wordpress Custom Post Types
Wordpress Custom Post TypesWordpress Custom Post Types
Wordpress Custom Post Types
 
WordPress 3 Custom Post Types
WordPress 3 Custom Post TypesWordPress 3 Custom Post Types
WordPress 3 Custom Post Types
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post Types
 
Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014
 
Custom post types - WordPress
Custom post types - WordPressCustom post types - WordPress
Custom post types - WordPress
 
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
 
WordCamp Kent 2019 - WP 101: Custom Post Type & Custom Fields
WordCamp Kent 2019 - WP 101: Custom Post Type & Custom FieldsWordCamp Kent 2019 - WP 101: Custom Post Type & Custom Fields
WordCamp Kent 2019 - WP 101: Custom Post Type & Custom Fields
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012
 
WordPress can do that?!
WordPress can do that?!WordPress can do that?!
WordPress can do that?!
 
ACHLS Introduction To Blogging
ACHLS Introduction To BloggingACHLS Introduction To Blogging
ACHLS Introduction To Blogging
 
WP 101 - Custom Fields & Post Types
WP 101 - Custom Fields & Post TypesWP 101 - Custom Fields & Post Types
WP 101 - Custom Fields & Post Types
 
From 0 to 100 with Content types
From 0 to 100 with Content typesFrom 0 to 100 with Content types
From 0 to 100 with Content types
 
WordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenWordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-Between
 
The very introduction to content management systems
The very introduction to content management systemsThe very introduction to content management systems
The very introduction to content management systems
 
SPS Dayton Content Types
SPS Dayton Content TypesSPS Dayton Content Types
SPS Dayton Content Types
 
Advanced Intro to Wordpress
Advanced Intro to WordpressAdvanced Intro to Wordpress
Advanced Intro to Wordpress
 
How to Use Wordpress (for Writers and Bloggers)
How to Use Wordpress (for Writers and Bloggers)How to Use Wordpress (for Writers and Bloggers)
How to Use Wordpress (for Writers and Bloggers)
 

Recently uploaded

(Generative) AI & Marketing: - Out of the Hype - Empowering the Marketing M...
(Generative) AI & Marketing: - Out of the Hype - Empowering the Marketing M...(Generative) AI & Marketing: - Out of the Hype - Empowering the Marketing M...
(Generative) AI & Marketing: - Out of the Hype - Empowering the Marketing M...Hugues Rey
 
Infographics about SEO strategies and uses
Infographics about SEO strategies and usesInfographics about SEO strategies and uses
Infographics about SEO strategies and usesbhavanirupeshmoksha
 
Codes and Conventions of Film Magazine Covers.pptx
Codes and Conventions of Film Magazine Covers.pptxCodes and Conventions of Film Magazine Covers.pptx
Codes and Conventions of Film Magazine Covers.pptxGeorgeCulica
 
Exploring The World Of Adult Ad Networks.pdf
Exploring The World Of Adult Ad Networks.pdfExploring The World Of Adult Ad Networks.pdf
Exploring The World Of Adult Ad Networks.pdfadult marketing
 
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdfDigital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdfDemandbase
 
From Chance to Choice - Tactical Link Building for International SEO
From Chance to Choice - Tactical Link Building for International SEOFrom Chance to Choice - Tactical Link Building for International SEO
From Chance to Choice - Tactical Link Building for International SEOSzymon Słowik
 
VIP Call Girls In Green Park 9654467111 Escorts Service
VIP Call Girls In Green Park 9654467111 Escorts ServiceVIP Call Girls In Green Park 9654467111 Escorts Service
VIP Call Girls In Green Park 9654467111 Escorts ServiceSapana Sha
 
The 10 Most Inspirational Leaders LEADING THE WAY TO SUCCESS, 2024
The 10 Most Inspirational Leaders LEADING THE WAY TO SUCCESS, 2024The 10 Most Inspirational Leaders LEADING THE WAY TO SUCCESS, 2024
The 10 Most Inspirational Leaders LEADING THE WAY TO SUCCESS, 2024CIO Business World
 
DIGITAL MARKETING STRATEGY_INFOGRAPHIC IMAGE.pdf
DIGITAL MARKETING STRATEGY_INFOGRAPHIC IMAGE.pdfDIGITAL MARKETING STRATEGY_INFOGRAPHIC IMAGE.pdf
DIGITAL MARKETING STRATEGY_INFOGRAPHIC IMAGE.pdfmayanksharma0441
 
Jai Institute for Parenting Program Guide
Jai Institute for Parenting Program GuideJai Institute for Parenting Program Guide
Jai Institute for Parenting Program Guidekiva6
 
The power of SEO-driven market intelligence
The power of SEO-driven market intelligenceThe power of SEO-driven market intelligence
The power of SEO-driven market intelligenceHinde Lamrani
 
The 10 Most Influential CMO's Leading the Way of Success, 2024 (Final file) (...
The 10 Most Influential CMO's Leading the Way of Success, 2024 (Final file) (...The 10 Most Influential CMO's Leading the Way of Success, 2024 (Final file) (...
The 10 Most Influential CMO's Leading the Way of Success, 2024 (Final file) (...CIO Business World
 
ASO Process: What is App Store Optimization
ASO Process: What is App Store OptimizationASO Process: What is App Store Optimization
ASO Process: What is App Store OptimizationAli Raza
 
Influencer Marketing Power point presentation
Influencer Marketing  Power point presentationInfluencer Marketing  Power point presentation
Influencer Marketing Power point presentationdgtivemarketingagenc
 
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon GarsideInbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garsiderobwhite630290
 
Exploring Web 3.0 Growth marketing: Navigating the Future of the Internet
Exploring Web 3.0 Growth marketing: Navigating the Future of the InternetExploring Web 3.0 Growth marketing: Navigating the Future of the Internet
Exploring Web 3.0 Growth marketing: Navigating the Future of the Internetnehapardhi711
 
Digital Marketing in 5G Era - Digital Transformation in 5G Age
Digital Marketing in 5G Era - Digital Transformation in 5G AgeDigital Marketing in 5G Era - Digital Transformation in 5G Age
Digital Marketing in 5G Era - Digital Transformation in 5G AgeDigiKarishma
 
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Talent Management for mba 3rd sem useful
Talent Management for mba 3rd sem usefulTalent Management for mba 3rd sem useful
Talent Management for mba 3rd sem usefulAtifaArbar
 
top marketing posters - Fresh Spar Technologies - Manojkumar C
top marketing posters - Fresh Spar Technologies - Manojkumar Ctop marketing posters - Fresh Spar Technologies - Manojkumar C
top marketing posters - Fresh Spar Technologies - Manojkumar CManojkumar C
 

Recently uploaded (20)

(Generative) AI & Marketing: - Out of the Hype - Empowering the Marketing M...
(Generative) AI & Marketing: - Out of the Hype - Empowering the Marketing M...(Generative) AI & Marketing: - Out of the Hype - Empowering the Marketing M...
(Generative) AI & Marketing: - Out of the Hype - Empowering the Marketing M...
 
Infographics about SEO strategies and uses
Infographics about SEO strategies and usesInfographics about SEO strategies and uses
Infographics about SEO strategies and uses
 
Codes and Conventions of Film Magazine Covers.pptx
Codes and Conventions of Film Magazine Covers.pptxCodes and Conventions of Film Magazine Covers.pptx
Codes and Conventions of Film Magazine Covers.pptx
 
Exploring The World Of Adult Ad Networks.pdf
Exploring The World Of Adult Ad Networks.pdfExploring The World Of Adult Ad Networks.pdf
Exploring The World Of Adult Ad Networks.pdf
 
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdfDigital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
 
From Chance to Choice - Tactical Link Building for International SEO
From Chance to Choice - Tactical Link Building for International SEOFrom Chance to Choice - Tactical Link Building for International SEO
From Chance to Choice - Tactical Link Building for International SEO
 
VIP Call Girls In Green Park 9654467111 Escorts Service
VIP Call Girls In Green Park 9654467111 Escorts ServiceVIP Call Girls In Green Park 9654467111 Escorts Service
VIP Call Girls In Green Park 9654467111 Escorts Service
 
The 10 Most Inspirational Leaders LEADING THE WAY TO SUCCESS, 2024
The 10 Most Inspirational Leaders LEADING THE WAY TO SUCCESS, 2024The 10 Most Inspirational Leaders LEADING THE WAY TO SUCCESS, 2024
The 10 Most Inspirational Leaders LEADING THE WAY TO SUCCESS, 2024
 
DIGITAL MARKETING STRATEGY_INFOGRAPHIC IMAGE.pdf
DIGITAL MARKETING STRATEGY_INFOGRAPHIC IMAGE.pdfDIGITAL MARKETING STRATEGY_INFOGRAPHIC IMAGE.pdf
DIGITAL MARKETING STRATEGY_INFOGRAPHIC IMAGE.pdf
 
Jai Institute for Parenting Program Guide
Jai Institute for Parenting Program GuideJai Institute for Parenting Program Guide
Jai Institute for Parenting Program Guide
 
The power of SEO-driven market intelligence
The power of SEO-driven market intelligenceThe power of SEO-driven market intelligence
The power of SEO-driven market intelligence
 
The 10 Most Influential CMO's Leading the Way of Success, 2024 (Final file) (...
The 10 Most Influential CMO's Leading the Way of Success, 2024 (Final file) (...The 10 Most Influential CMO's Leading the Way of Success, 2024 (Final file) (...
The 10 Most Influential CMO's Leading the Way of Success, 2024 (Final file) (...
 
ASO Process: What is App Store Optimization
ASO Process: What is App Store OptimizationASO Process: What is App Store Optimization
ASO Process: What is App Store Optimization
 
Influencer Marketing Power point presentation
Influencer Marketing  Power point presentationInfluencer Marketing  Power point presentation
Influencer Marketing Power point presentation
 
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon GarsideInbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
 
Exploring Web 3.0 Growth marketing: Navigating the Future of the Internet
Exploring Web 3.0 Growth marketing: Navigating the Future of the InternetExploring Web 3.0 Growth marketing: Navigating the Future of the Internet
Exploring Web 3.0 Growth marketing: Navigating the Future of the Internet
 
Digital Marketing in 5G Era - Digital Transformation in 5G Age
Digital Marketing in 5G Era - Digital Transformation in 5G AgeDigital Marketing in 5G Era - Digital Transformation in 5G Age
Digital Marketing in 5G Era - Digital Transformation in 5G Age
 
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Lajpat Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Talent Management for mba 3rd sem useful
Talent Management for mba 3rd sem usefulTalent Management for mba 3rd sem useful
Talent Management for mba 3rd sem useful
 
top marketing posters - Fresh Spar Technologies - Manojkumar C
top marketing posters - Fresh Spar Technologies - Manojkumar Ctop marketing posters - Fresh Spar Technologies - Manojkumar C
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
  • 15. 15 Creating Advanced Custom Post Types Complete code to register a custom post type
  • 16. 16 Creating a Custom Taxonomy Code to register a custom taxomony
  • 17. Using Existing Plugins Using existing, supported and frequently updated plugins is a good way to manage your custom post types and custom fields
  • 18. 18 Custom Post Type UI – Post Type Super easy to create post types and taxonomies
  • 19. 19 Custom Post Type UI -Taxonomy Super easy to create post types and taxonomies
  • 20. 20 Display Post Types In Your Theme Code to display a custom post type
  • 21. 21 Connecting Post Types Together Use a plugin to associate post types together to create a relationship
  • 22. 22 Connecting Post Types Together create a relationship – Add the PHP and get the connections meta box on your post types
  • 23. 23 Connecting Post Types Together Display connected posts in theme template file with PHP
  • 24. 24 Connecting Post Types Together Display connected posts with the provided P2P widget
  • 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: