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

Joomla 4 custom fields and workflow
Joomla 4 custom fields and workflowJoomla 4 custom fields and workflow
Joomla 4 custom fields and workflowTim Plummer
 
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 WebsiteDhairya Shah
 
TinyMCE for Joomla
TinyMCE for JoomlaTinyMCE for Joomla
TinyMCE for JoomlaTim Plummer
 
Building a website with WordPress
Building a website with WordPressBuilding a website with WordPress
Building a website with WordPressAnthony Montalbano
 
Adding Content to your WordPress Website
Adding Content to your WordPress WebsiteAdding Content to your WordPress Website
Adding Content to your WordPress WebsiteRiceDesign
 
SugarCRM: Tips Tricks And Tools
SugarCRM: Tips Tricks And ToolsSugarCRM: Tips Tricks And Tools
SugarCRM: Tips Tricks And ToolsJosh Sweeney
 
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 PluginsRich Plakas
 
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
 
Fm Rh Doc Bash Aug2011
Fm Rh Doc Bash Aug2011Fm Rh Doc Bash Aug2011
Fm Rh Doc Bash Aug2011Nandini Gupta
 
Aujug 2020 joomla 4 workflow
Aujug 2020 joomla 4 workflowAujug 2020 joomla 4 workflow
Aujug 2020 joomla 4 workflowTim Plummer
 
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 2015BobWP.com
 
WordPress for Beginners
WordPress for BeginnersWordPress for Beginners
WordPress for BeginnersMichelle Ames
 
Schipul Webinar - Intro To Wordpress
Schipul Webinar - Intro To WordpressSchipul Webinar - Intro To Wordpress
Schipul Webinar - Intro To WordpressCaitlin Jeansonne
 
Cross CMS plugin development using AWF
Cross CMS plugin development using AWFCross CMS plugin development using AWF
Cross CMS plugin development using AWFTim Plummer
 
Wordpress Intro
Wordpress IntroWordpress Intro
Wordpress IntroRicha Goel
 
Word press themeing & more
Word press themeing & moreWord press themeing & more
Word press themeing & morePhelan Riessen
 

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

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 Toronto08Jamie Oastler
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
 
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...Scott DeLoach
 
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.Css Founder
 
Practical Blogs for Writers
Practical Blogs for WritersPractical Blogs for Writers
Practical Blogs for WritersSusan Stewart
 
Dreamweaver Course2006 Week1
Dreamweaver Course2006 Week1Dreamweaver Course2006 Week1
Dreamweaver Course2006 Week1Rod Nicholls
 
Selecting A Content Management System
Selecting A Content Management SystemSelecting A Content Management System
Selecting A Content Management SystemNew Marketing Labs
 
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 ExpressionEngineOttergoose
 
WordPress How To by Sherif Morgan
WordPress How To by Sherif MorganWordPress How To by Sherif Morgan
WordPress How To by Sherif MorganOnlineBizSmarts.com
 
Prabhanjan Panigrahi
Prabhanjan PanigrahiPrabhanjan Panigrahi
Prabhanjan PanigrahiAnirban Saha
 
Benefits of the CodeIgniter Framework
Benefits of the CodeIgniter FrameworkBenefits of the CodeIgniter Framework
Benefits of the CodeIgniter FrameworkToby Beresford
 
Learn html and css from scratch
Learn html and css from scratchLearn html and css from scratch
Learn html and css from scratchMohd Manzoor Ahmed
 

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

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
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...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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 challengesrafiqahmad00786416
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
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 businesspanagenda
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Recently uploaded (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

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)