Creating Custom PostTypesUCF MarketingBrandon Groveswebcom@ucf.eduhttp://www.slideshare.net/DFieldFL/wordpress-create-cust...
Outline UCF Marketing background What are custom post types (CPTs) How to create a CPTs How to display CPTs How we (S...
UCF Marketing backgroundWeb Development Team Roger Wolf Jo Greybill Brandon GrovesBeen using WordPress for 5 YearsDevel...
What are custom posttypes (CPTs)Most content uses post types [1] Posts Pages Navigation Menu Attachment RevisionCPT[1...
A way of organizing content Announcements People DocumentsAdd custom data Meta data Featured image TaxonomiesRemove ...
 When creating CPTs youhave to also create a way ofdisplaying them CPTs are NOT displayedanywhere by default(except via ...
Has anyone used custom post types?Other use-cases http://www.bard.edu/ccs/ http://www.cec.fiu.edu/academics/bachelor/ h...
How to create CPTsSelling ACME products List all product that are sold Individual product page with descriptionsResource...
Reserved Post Types [2] post page attachment revision nav_menu_itemRegister CPT [2] Post type ID (required) Argumen...
Hook function into the workflow Functions.php file is auto loaded [3] Convenience method add_action [4] [5] When to exe...
Code {theme}/functions.php
CPT displays on left menu Displays posts Add new postA CPT by default looks thesame as Post Title Content/Body
How to display CPTsCreate 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 file...
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)...
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_Hier...
Displaying single CTP (single-acme_product.php)
How we (SMCA) create CPTsResources https://github.com/UCF/Wordpress-Generic-ThemeCode custom-post-types.php (Base CPT Cl...
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_typesarray (functions/config.php)
How we (SMCA) create CPTs
ConclusionWordPress is more than a blogging toolCPTs help group like contentCPTs are NOT displayed by default Manually li...
Questions?http://www.slideshare.net/DFieldFL/wordpress-create-custom-post-typesContact: webcom@ucf.edu
Upcoming SlideShare
Loading in...5
×

WordPress - Create Custom Post Types

1,296

Published on

Explains wordpress custom posts types and how University of Central Florida's (UCF) Marketing web team creates custom post types.

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,296
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

WordPress - Create Custom Post Types

  1. 1. Creating Custom PostTypesUCF MarketingBrandon Groveswebcom@ucf.eduhttp://www.slideshare.net/DFieldFL/wordpress-create-custom-post-types
  2. 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. 3. UCF Marketing backgroundWeb Development Team Roger Wolf Jo Greybill Brandon GrovesBeen using WordPress for 5 YearsDevelop ~12 sites a yearSites 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. 4. What are custom posttypes (CPTs)Most content uses post types [1] Posts Pages Navigation Menu Attachment RevisionCPT[1] http://codex.wordpress.org/Post_Types#Custom_Post_Types
  5. 5. A way of organizing content Announcements People DocumentsAdd custom data Meta data Featured image TaxonomiesRemove fields Title ContentMeta data
  6. 6.  When creating CPTs youhave to also create a way ofdisplaying them CPTs are NOT displayedanywhere by default(except via single.php)
  7. 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. 8. How to create CPTsSelling ACME products List all product that are sold Individual product page with descriptionsResources http://codex.wordpress.org/Post_Types http://codex.wordpress.org/Function_Reference/register_post_type http://codex.wordpress.org/Plugin_API/Action_Reference
  9. 9. Reserved Post Types [2] post page attachment revision nav_menu_itemRegister 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. 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
  11. 11. Code {theme}/functions.php
  12. 12. CPT displays on left menu Displays posts Add new postA CPT by default looks thesame as Post Title Content/Body
  13. 13. How to display CPTsCreate products Anvil Giant Rubber Band
  14. 14. Where are our products?
  15. 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. 16. Creating our own display page
  17. 17. Empty page Defaults to page.php
  18. 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_LoopThe Loop
  19. 19. Products page
  20. 20. View a product Defaults to single.php [6][6] http://codex.wordpress.org/Template_Hierarchy
  21. 21. Create a custom display Displaying single CTP (single-{post-type-id}.php) [6][6] http://codex.wordpress.org/Template_Hierarchy
  22. 22. Displaying single CTP (single-acme_product.php)
  23. 23. How we (SMCA) create CPTsResources https://github.com/UCF/Wordpress-Generic-ThemeCode custom-post-types.php (Base CPT Class)
  24. 24. Defining a new CPT (Document) Inherit CustomePostType class Modify variables if needed
  25. 25. Defining a new CPT Add custom functionality
  26. 26. Enabling CPT (registering) Add CPT class name to the Config’s custom_post_typesarray (functions/config.php)
  27. 27. How we (SMCA) create CPTs
  28. 28. ConclusionWordPress is more than a blogging toolCPTs help group like contentCPTs are NOT displayed by default Manually link to it Create a display page listing CPTs (page templates) Create unique single post display (post templates)
  29. 29. Questions?http://www.slideshare.net/DFieldFL/wordpress-create-custom-post-typesContact: webcom@ucf.edu
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×