SlideShare a Scribd company logo
1 of 29
Creating Custom Post
Types
UCF Marketing
Brandon Groves
webcom@ucf.edu
http://www.slideshare.net/DFieldFL/wordpress-create-custom-post-types
Outline
 UCF Marketing background
 What are custom post types (CPTs)
 How to create a CPTs
 How to display CPTs
 How we (SMCA) create CPTs
 Conclusion
 Questions/Comments
UCF Marketing background
Web Development Team
 Roger Wolf
 Jo Greybill
 Brandon Groves
Been using WordPress for 5 Years
Develop ~12 sites a year
Sites we developed using WordPress
 http://www.ucf.edu
 http://today.ucf.edu
 http://pegasus.ucf.edu
 http://hr.ucf.edu
 http://hospitality.ucf.edu
What are custom post
types (CPTs)
Most content uses post types [1]
 Posts
 Pages
 Navigation Menu
 Attachment
 Revision
CPT
[1] http://codex.wordpress.org/Post_Types#Custom_Post_Types
A way of organizing content
 Announcements
 People
 Documents
Add custom data
 Meta data
 Featured image
 Taxonomies
Remove fields
 Title
 Content
Meta data
 When creating CPTs you
have to also create a way of
displaying them
 CPTs are NOT displayed
anywhere by default
(except via single.php)
Has anyone used custom post types?
Other use-cases
 http://www.bard.edu/ccs/
 http://www.cec.fiu.edu/academics/bachelor/
 http://www.nicholls.edu/admission/
 http://pegasus.ucf.edu/
How to create CPTs
Selling ACME products
 List all product that are sold
 Individual product page with descriptions
Resources
 http://codex.wordpress.org/Post_Types
 http://codex.wordpress.org/Function_Refere
nce/register_post_type
 http://codex.wordpress.org/Plugin_API/Actio
n_Reference
Reserved Post Types [2]
 post
 page
 attachment
 revision
 nav_menu_item
Register CPT [2]
 Post type ID (required)
 Arguments – defining characteristics of the CPT
[2] http://codex.wordpress.org/Function_Reference/register_post_type#Reserved_Post_Types
Hook function into the workflow
 Functions.php file is auto loaded [3]
 Convenience method add_action [4] [5]
 When to execute our code
 What code to execute
 Priority compared to other added actions
 Arguments
[3] http://codex.wordpress.org/Theme_Development#Functions_File
[4] http://codex.wordpress.org/Function_Reference/add_action
[5] http://codex.wordpress.org/Plugin_API/Action_Reference
Code
 {theme}/functions.php
CPT displays on left menu
 Displays posts
 Add new post
A CPT by default looks the
same as Post
 Title
 Content/Body
How to display CPTs
Create products
 Anvil
 Giant Rubber Band
Where are our products?
Template structure [6]
 A single page to display products
 Pages are automatically put into the menu
 page-{slug}.php filename
 Content title is used for the slug
[6] http://codex.wordpress.org/Template_Hierarchy
Creating our own display page
Empty page
 Defaults to page.php
Create template
 using the page slug file naming convention
(page-products.php)
 Querie our CPT of amce_products (The Loop) [7]
[7] http://codex.wordpress.org/The_Loop
The Loop
Products page
View a product
 Defaults to single.php [6]
[6] http://codex.wordpress.org/Template_Hierarchy
Create a custom display
 Displaying single CTP (single-{post-type-id}.php) [6]
[6] http://codex.wordpress.org/Template_Hierarchy
Displaying single CTP (single-acme_product.php)
How we (SMCA) create CPTs
Resources
 https://github.com/UCF/Wordpress-Generic-Theme
Code
 custom-post-types.php (Base CPT Class)
Defining a new CPT (Document)
 Inherit CustomePostType class
 Modify variables if needed
Defining a new CPT
 Add custom functionality
Enabling CPT (registering)
 Add CPT class name to the Config’s custom_post_types
array (functions/config.php)
How we (SMCA) create CPTs
Conclusion
WordPress is more than a blogging tool
CPTs help group like content
CPTs are NOT displayed by default
 Manually link to it
 Create a display page listing CPTs (page templates)
 Create unique single post display (post templates)
Questions?
http://www.slideshare.net/DFieldFL/wordpress-create-custom-post-types
Contact: webcom@ucf.edu

More Related Content

What's hot

WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...
Denise Williams
 

What's hot (20)

Joomla 4 custom fields and workflow
Joomla 4 custom fields and workflowJoomla 4 custom fields and workflow
Joomla 4 custom fields and workflow
 
Handling User-Generated Duplicate Content on Your Website
Handling User-Generated Duplicate Content on Your WebsiteHandling User-Generated Duplicate Content on Your Website
Handling User-Generated Duplicate Content on Your Website
 
TinyMCE for Joomla
TinyMCE for JoomlaTinyMCE for Joomla
TinyMCE for Joomla
 
Web development is now simplified with Wordpress CMS
Web development is now simplified with Wordpress CMSWeb development is now simplified with Wordpress CMS
Web development is now simplified with Wordpress CMS
 
Learning center usage
Learning center usageLearning center usage
Learning center usage
 
Building a website with WordPress
Building a website with WordPressBuilding a website with WordPress
Building a website with WordPress
 
Adding Content to your WordPress Website
Adding Content to your WordPress WebsiteAdding Content to your WordPress Website
Adding Content to your WordPress Website
 
SugarCRM: Tips Tricks And Tools
SugarCRM: Tips Tricks And ToolsSugarCRM: Tips Tricks And Tools
SugarCRM: Tips Tricks And Tools
 
Exploring the WordPress Dashboard and How to Pick & Install Plugins
Exploring the WordPress Dashboard and How to Pick & Install PluginsExploring the WordPress Dashboard and How to Pick & Install Plugins
Exploring the WordPress Dashboard and How to Pick & Install Plugins
 
WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...
 
Wordpress for Beginners: 10 Must Knows
Wordpress for Beginners: 10 Must KnowsWordpress for Beginners: 10 Must Knows
Wordpress for Beginners: 10 Must Knows
 
Fm Rh Doc Bash Aug2011
Fm Rh Doc Bash Aug2011Fm Rh Doc Bash Aug2011
Fm Rh Doc Bash Aug2011
 
Aujug 2020 joomla 4 workflow
Aujug 2020 joomla 4 workflowAujug 2020 joomla 4 workflow
Aujug 2020 joomla 4 workflow
 
What Is WordPress and Why Should I Use It? - Workshop April 2015
What Is WordPress and Why Should I Use It? - Workshop April 2015What Is WordPress and Why Should I Use It? - Workshop April 2015
What Is WordPress and Why Should I Use It? - Workshop April 2015
 
WordPress for Beginners
WordPress for BeginnersWordPress for Beginners
WordPress for Beginners
 
Schipul Webinar - Intro To Wordpress
Schipul Webinar - Intro To WordpressSchipul Webinar - Intro To Wordpress
Schipul Webinar - Intro To Wordpress
 
Cross CMS plugin development using AWF
Cross CMS plugin development using AWFCross CMS plugin development using AWF
Cross CMS plugin development using AWF
 
Wordpress Intro
Wordpress IntroWordpress Intro
Wordpress Intro
 
The WordPress Author
The WordPress AuthorThe WordPress Author
The WordPress Author
 
Word press themeing & more
Word press themeing & moreWord press themeing & more
Word press themeing & more
 

Similar to WordPress - Create Custom Post Types

Dreamweaver Course2006 Week1
Dreamweaver Course2006 Week1Dreamweaver Course2006 Week1
Dreamweaver Course2006 Week1
Rod Nicholls
 
Building a Simple, Responsive Website with ExpressionEngine
Building a Simple, Responsive Website with ExpressionEngineBuilding a Simple, Responsive Website with ExpressionEngine
Building a Simple, Responsive Website with ExpressionEngine
Ottergoose
 
Prabhanjan Panigrahi
Prabhanjan PanigrahiPrabhanjan Panigrahi
Prabhanjan Panigrahi
Anirban Saha
 

Similar to WordPress - Create Custom Post Types (20)

Test ss 1
Test ss 1Test ss 1
Test ss 1
 
Wordpress Beyond A Blog Word Camp Toronto08
Wordpress Beyond A Blog Word Camp Toronto08Wordpress Beyond A Blog Word Camp Toronto08
Wordpress Beyond A Blog Word Camp Toronto08
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
WordPress 101
WordPress 101WordPress 101
WordPress 101
 
Lecture7
Lecture7Lecture7
Lecture7
 
Extending MadCap Flare HTML5 Targets with jQuery - MadWorld 2016, Scott DeLoa...
Extending MadCap Flare HTML5 Targets with jQuery - MadWorld 2016, Scott DeLoa...Extending MadCap Flare HTML5 Targets with jQuery - MadWorld 2016, Scott DeLoa...
Extending MadCap Flare HTML5 Targets with jQuery - MadWorld 2016, Scott DeLoa...
 
Open Source CMS
Open Source CMSOpen Source CMS
Open Source CMS
 
It’s a blog. it’s a website.
It’s a blog. it’s a website.It’s a blog. it’s a website.
It’s a blog. it’s a website.
 
Killer word press-checklist
Killer word press-checklistKiller word press-checklist
Killer word press-checklist
 
Wordpress as a CMS
Wordpress as a CMSWordpress as a CMS
Wordpress as a CMS
 
Drupal SEO
Drupal SEODrupal SEO
Drupal SEO
 
Practical Blogs for Writers
Practical Blogs for WritersPractical Blogs for Writers
Practical Blogs for Writers
 
Dreamweaver Course2006 Week1
Dreamweaver Course2006 Week1Dreamweaver Course2006 Week1
Dreamweaver Course2006 Week1
 
Selecting A Content Management System
Selecting A Content Management SystemSelecting A Content Management System
Selecting A Content Management System
 
Building a Simple, Responsive Website with ExpressionEngine
Building a Simple, Responsive Website with ExpressionEngineBuilding a Simple, Responsive Website with ExpressionEngine
Building a Simple, Responsive Website with ExpressionEngine
 
WordPress How To by Sherif Morgan
WordPress How To by Sherif MorganWordPress How To by Sherif Morgan
WordPress How To by Sherif Morgan
 
Prabhanjan Panigrahi
Prabhanjan PanigrahiPrabhanjan Panigrahi
Prabhanjan Panigrahi
 
Benefits of the CodeIgniter Framework
Benefits of the CodeIgniter FrameworkBenefits of the CodeIgniter Framework
Benefits of the CodeIgniter Framework
 
Learn html and css from scratch
Learn html and css from scratchLearn html and css from scratch
Learn html and css from scratch
 
WordCamp Denmark Keynote
WordCamp Denmark KeynoteWordCamp Denmark Keynote
WordCamp Denmark Keynote
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

WordPress - Create Custom Post Types

  • 1. Creating Custom Post Types UCF Marketing Brandon Groves webcom@ucf.edu http://www.slideshare.net/DFieldFL/wordpress-create-custom-post-types
  • 2. Outline  UCF Marketing background  What are custom post types (CPTs)  How to create a CPTs  How to display CPTs  How we (SMCA) create CPTs  Conclusion  Questions/Comments
  • 3. UCF Marketing background Web Development Team  Roger Wolf  Jo Greybill  Brandon Groves Been using WordPress for 5 Years Develop ~12 sites a year Sites we developed using WordPress  http://www.ucf.edu  http://today.ucf.edu  http://pegasus.ucf.edu  http://hr.ucf.edu  http://hospitality.ucf.edu
  • 4. What are custom post types (CPTs) Most content uses post types [1]  Posts  Pages  Navigation Menu  Attachment  Revision CPT [1] http://codex.wordpress.org/Post_Types#Custom_Post_Types
  • 5. A way of organizing content  Announcements  People  Documents Add custom data  Meta data  Featured image  Taxonomies Remove fields  Title  Content Meta data
  • 6.  When creating CPTs you have to also create a way of displaying them  CPTs are NOT displayed anywhere by default (except via single.php)
  • 7. Has anyone used custom post types? Other use-cases  http://www.bard.edu/ccs/  http://www.cec.fiu.edu/academics/bachelor/  http://www.nicholls.edu/admission/  http://pegasus.ucf.edu/
  • 8. How to create CPTs Selling ACME products  List all product that are sold  Individual product page with descriptions Resources  http://codex.wordpress.org/Post_Types  http://codex.wordpress.org/Function_Refere nce/register_post_type  http://codex.wordpress.org/Plugin_API/Actio n_Reference
  • 9. Reserved Post Types [2]  post  page  attachment  revision  nav_menu_item Register CPT [2]  Post type ID (required)  Arguments – defining characteristics of the CPT [2] http://codex.wordpress.org/Function_Reference/register_post_type#Reserved_Post_Types
  • 10. Hook function into the workflow  Functions.php file is auto loaded [3]  Convenience method add_action [4] [5]  When to execute our code  What code to execute  Priority compared to other added actions  Arguments [3] http://codex.wordpress.org/Theme_Development#Functions_File [4] http://codex.wordpress.org/Function_Reference/add_action [5] http://codex.wordpress.org/Plugin_API/Action_Reference
  • 12. CPT displays on left menu  Displays posts  Add new post A CPT by default looks the same as Post  Title  Content/Body
  • 13. How to display CPTs Create products  Anvil  Giant Rubber Band
  • 14. Where are our products?
  • 15. Template structure [6]  A single page to display products  Pages are automatically put into the menu  page-{slug}.php filename  Content title is used for the slug [6] http://codex.wordpress.org/Template_Hierarchy
  • 16. Creating our own display page
  • 17. Empty page  Defaults to page.php
  • 18. Create template  using the page slug file naming convention (page-products.php)  Querie our CPT of amce_products (The Loop) [7] [7] http://codex.wordpress.org/The_Loop The Loop
  • 20. View a product  Defaults to single.php [6] [6] http://codex.wordpress.org/Template_Hierarchy
  • 21. Create a custom display  Displaying single CTP (single-{post-type-id}.php) [6] [6] http://codex.wordpress.org/Template_Hierarchy
  • 22. Displaying single CTP (single-acme_product.php)
  • 23. How we (SMCA) create CPTs Resources  https://github.com/UCF/Wordpress-Generic-Theme Code  custom-post-types.php (Base CPT Class)
  • 24. Defining a new CPT (Document)  Inherit CustomePostType class  Modify variables if needed
  • 25. Defining a new CPT  Add custom functionality
  • 26. Enabling CPT (registering)  Add CPT class name to the Config’s custom_post_types array (functions/config.php)
  • 27. How we (SMCA) create CPTs
  • 28. Conclusion WordPress is more than a blogging tool CPTs help group like content CPTs are NOT displayed by default  Manually link to it  Create a display page listing CPTs (page templates)  Create unique single post display (post templates)