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
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
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
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)