SlideShare a Scribd company logo
WordPress Custom Post Types In-Depth
    Colin Vernon & Joachim Kudish
Organizing Content of
Different Types

•   It’s about Content: websites usually have
    content of different types: posts, pages,
    articles, videos, newsletters, products,
    books, anything

•   A question of content and information
    architecture
    vs data structure
Back in the day...

 •   Websites were simpler... ?

 •   Created custom architecture with pages

 •   Different content types could be “faked” with
     categories and category navigation
What are custom post
types?


•   Introduced in WordPress 2.9, much
    simplified in 3.0 and expanded upon in 3.1

•   Classic blog format used categories to
    classify content

•   Custom post types allow for more in-depth
    fine-grained control and separation of
    content

•   Better name = custom content type
Advanced uses of CPTs



•   Products (WP E-Commerce uses it -
    http://getshopped.org/)

•   Job Postings

•   Testimonials

•   Newsletters

•   Possibilities are endless!
Registering Custom Post
Types
 Graphical/easy way:

  •   Plug and play, simple interfaces

  •   Custom Post Type UI - http://
      wordpress.org/extend/plugins/custom-
      post-type-ui/

  •   GD Custom Posts And Taxonomies Tools
      - http://wordpress.org/extend/plugins/
      gd-taxonomies-tools/

  •   More Types - http://wordpress.org/
      extend/plugins/more-types/

  •   Lots of other examples
GRAPHICAL


  ≠
   USER
INTERFACE
Code Method



 register_post_type();

  •   http://codex.wordpress.org/
      Function_Reference/register_post_type

  •   core function

  •   lots of $args for lots of possibilities
http://pastie.org/2169751 (taken from the WP Codex)
$args = customization
Admin:

 •   labels, show_ui, show_in_menu,
     menu_position, menu_icon,
     capability_type, capabilities,
     map_meta_cap, register_meta_box_cb,
     can_export, show_in_nav_menus

Front-end:

 •   public, publicly_queryable,
     exclude_from_search, hierarchical,
     taxonomies

Permalinks:
Code = Good ☺


•   versionable (svn, git, etc...)

•   core WordPress way

•   easy to edit at any time

•   you keep full control

•   similar to what GUI plugins do,
    but without relying on the database

•   only a few lines of code
Some Shortcomings of
WP API



 •   lots of repetition in the code

 •   not good enough defaults (labels!)

 •   now has good support for archives (since
     3.1) but still no built-in support for feed
     permalinks, etc.
Alternate Code Methods
•   Smarter Custom Post Types by Matt Wiebe:


    •   http://somadesign.ca/projects/smarter-
        custom-post-types/

    •   now obsolete because of 3.1’s archive/
        permalinks abilities

•   Our own SLD Custom Content & Taxonomy

    •   https://github.com/jkudish/SLD-
        Custom-Post-Types-Taxonomies-for-
        Wordpress

    •   wrapper plugin/class for
Taking CPTs even
further
•   Taxonomies

    •   further way of classifying content

    •   group different content types together
        based on taxonomies

    •   use built-in taxonomies (categories &
        tags) or custom taxonomies

    •   register custom taxonomies with code,
        not GUI plugins

    •   use the core WP function
        register_taxonomy()
        http://codex.wordpress.org/
        Function_Reference/register_taxonomy
http://pastie.org/2170028
Taking CPTs even
further

•   Meta fields / meta boxes / custom fields:

    •   allow you to store any information

    •   extremely expandable

    •   WordPress API requires a lot of code, no
        good defaults:

        •   add_meta_box()

        •   http://codex.wordpress.org/
            Function_Reference/add_meta_box
Meta Boxes
•   similarly to content types & taxonomies,
    there are GUI plugins to register meta
    boxes

    •   More Fields: http://wordpress.org/
        extend/plugins/more-fields/

    •   Advanced Custom Fields: http://
        wordpress.org/extend/plugins/
        advanced-custom-fields/

    •   Verve Meta Boxes: http://
        wordpress.org/extend/plugins/verve-
        meta-boxes/
Easier Meta Fields


 •   Custom Metadata Manager by Mohammad
     Jangda

 •   http://wordpress.org/extend/plugins/
     custom-metadata/

 •   easy wrapper functions for adding meta
     boxes and custom fields
Custom Metadata
Manager
x_add_metadata_field(
 $slug,
 $object_types = 'post',
 $args = array()
 )
x_add_metadata_group(
 $slug,
 $object_types = 'post',
 $args = array()
 )
Even Further...
•   complex post to post (content to content)
    relations

    •   allows web app functionality à la Rails/
        Django

    •   posts 2 posts plugin: http://
        wordpress.org/extend/plugins/posts-to-
        posts/

•   different page/content templates = different
    set of fields
✔ Lessons Learned

•   use custom content types for anything that
    isn’t a blog post and isn’t a static page

•   if you’re a developer, don’t rely on the
    database to register CPTs

•   if you’re not a developer, hire a developer,
    learn to code (copy/paste) or use a plugin

•   best way to learn = read the codex, code and
    make mistakes
Extra links


 •   Custom post type & custom taxonomy
     generator: http://themergency.com/
     generators/

 •   Joachim’s WP.org profile page (the SLD
     helper class plugin will appear here once it’s
     live): http://profiles.wordpress.org/users/
     jkudish

 •   Colin’s WP.org profile page: http://
     profiles.wordpress.org/users/cvernon

 •   WordPress.tv (recorded presentation will
     appear here): http://wordpress.tv/
Thanks!
Any Questions?
Thanks!
       Any Questions?




http://stresslim.it/welovewp


@stresslimit /   http://stresslimitdesign.com

@jkudish /   http://jkudish.com
Thanks!
Any Questions?

More Related Content

What's hot

Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
Tammy Hart
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
Chandra Prakash Thapa
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011
David Carr
 
Extending WordPress
Extending WordPressExtending WordPress
Extending WordPress
Jonathan Bossenger
 
Custom Fields & Custom Metaboxes Overview
Custom Fields & Custom Metaboxes OverviewCustom Fields & Custom Metaboxes Overview
Custom Fields & Custom Metaboxes Overview
East Bay WordPress Meetup
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OSbenko
 
Intro to WordPress theme development
Intro to WordPress theme developmentIntro to WordPress theme development
Intro to WordPress theme development
Thad Allender
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
Amanda Giles
 
Put a little Backbone in your WordPress
Put a little Backbone in your WordPressPut a little Backbone in your WordPress
Put a little Backbone in your WordPress
adamsilverstein
 
Introduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingIntroduction to Custom WordPress Themeing
Introduction to Custom WordPress Themeing
Jamie Schmid
 
Advanced WordPress Development Environments
Advanced WordPress Development EnvironmentsAdvanced WordPress Development Environments
Advanced WordPress Development EnvironmentsBeau Lebens
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
elliotjaystocks
 
Theming 101
Theming 101Theming 101
Theming 101
WinnipegWordcamp
 
WordPress Theme Structure
WordPress Theme StructureWordPress Theme Structure
WordPress Theme Structure
keithdevon
 
Associations & JavaScript
Associations & JavaScriptAssociations & JavaScript
Associations & JavaScript
Joost Elfering
 
Javascript for the c# developer
Javascript for the c# developerJavascript for the c# developer
Javascript for the c# developer
Salvatore Fazio
 
Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep Dive
Axway Appcelerator
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)
Beau Lebens
 
OpenERP and Perl
OpenERP and PerlOpenERP and Perl
OpenERP and Perl
OpusVL
 

What's hot (20)

Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011
 
Extending WordPress
Extending WordPressExtending WordPress
Extending WordPress
 
Custom Fields & Custom Metaboxes Overview
Custom Fields & Custom Metaboxes OverviewCustom Fields & Custom Metaboxes Overview
Custom Fields & Custom Metaboxes Overview
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
 
Intro to WordPress theme development
Intro to WordPress theme developmentIntro to WordPress theme development
Intro to WordPress theme development
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
Put a little Backbone in your WordPress
Put a little Backbone in your WordPressPut a little Backbone in your WordPress
Put a little Backbone in your WordPress
 
Introduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingIntroduction to Custom WordPress Themeing
Introduction to Custom WordPress Themeing
 
Advanced WordPress Development Environments
Advanced WordPress Development EnvironmentsAdvanced WordPress Development Environments
Advanced WordPress Development Environments
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
 
Theming 101
Theming 101Theming 101
Theming 101
 
WordPress Theme Structure
WordPress Theme StructureWordPress Theme Structure
WordPress Theme Structure
 
Associations & JavaScript
Associations & JavaScriptAssociations & JavaScript
Associations & JavaScript
 
Javascript for the c# developer
Javascript for the c# developerJavascript for the c# developer
Javascript for the c# developer
 
Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep Dive
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
OpenERP and Perl
OpenERP and PerlOpenERP and Perl
OpenERP and Perl
 

Viewers also liked

Workshop 4: IJssel-Vechtdelta lessons learned
Workshop 4: IJssel-Vechtdelta lessons learnedWorkshop 4: IJssel-Vechtdelta lessons learned
Workshop 4: IJssel-Vechtdelta lessons learned
Bas van Dishoeck
 
Custom Post Types and Taxonomies
Custom Post Types and TaxonomiesCustom Post Types and Taxonomies
Custom Post Types and Taxonomies
Tammy Hart
 
WordPress 3 Custom Post Types
WordPress 3 Custom Post TypesWordPress 3 Custom Post Types
WordPress 3 Custom Post Types
Dave Zille
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginMainak Goswami
 
Anatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeAnatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeJulie Kuehl
 
WordPress Code Architecture
WordPress Code ArchitectureWordPress Code Architecture
WordPress Code Architecture
Mario Peshev
 
WordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress OptimizationWordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress Optimization
Joost de Valk
 
Beginning WordPress Plugin Development
Beginning WordPress Plugin DevelopmentBeginning WordPress Plugin Development
Beginning WordPress Plugin Development
Aizat Faiz
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short Tutorial
Christos Zigkolis
 

Viewers also liked (10)

Workshop 4: IJssel-Vechtdelta lessons learned
Workshop 4: IJssel-Vechtdelta lessons learnedWorkshop 4: IJssel-Vechtdelta lessons learned
Workshop 4: IJssel-Vechtdelta lessons learned
 
Custom Post Types and Taxonomies
Custom Post Types and TaxonomiesCustom Post Types and Taxonomies
Custom Post Types and Taxonomies
 
WordPress 3 Custom Post Types
WordPress 3 Custom Post TypesWordPress 3 Custom Post Types
WordPress 3 Custom Post Types
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
 
Anatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeAnatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress Theme
 
Architecture for WordPress on AWS
Architecture for WordPress on AWSArchitecture for WordPress on AWS
Architecture for WordPress on AWS
 
WordPress Code Architecture
WordPress Code ArchitectureWordPress Code Architecture
WordPress Code Architecture
 
WordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress OptimizationWordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress Optimization
 
Beginning WordPress Plugin Development
Beginning WordPress Plugin DevelopmentBeginning WordPress Plugin Development
Beginning WordPress Plugin Development
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short Tutorial
 

Similar to Custom Post Types in Depth at WordCamp Montreal

WordPress can do that?!
WordPress can do that?!WordPress can do that?!
WordPress can do that?!
Scott McNulty
 
WordPress - Open Source Overview Presentation
WordPress - Open Source Overview PresentationWordPress - Open Source Overview Presentation
WordPress - Open Source Overview Presentation
Andy Stratton
 
WordPress Complete Tutorial
WordPress Complete TutorialWordPress Complete Tutorial
WordPress Complete Tutorial
OpenSource Technologies Pvt. Ltd.
 
The Flexibility of WordPress
The Flexibility of WordPressThe Flexibility of WordPress
The Flexibility of WordPress
Stephanie Eckles
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012Stephanie Leary
 
The WordPress University
The WordPress UniversityThe WordPress University
The WordPress UniversityStephanie Leary
 
Open Source CMS Playroom
Open Source CMS PlayroomOpen Source CMS Playroom
Open Source CMS Playroomlibrarywebchic
 
From WordPress With Love
From WordPress With LoveFrom WordPress With Love
From WordPress With Love
Up2 Technology
 
WordPress as a CMS
WordPress as a CMSWordPress as a CMS
WordPress as a CMS
Stephanie Leary
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond blogging
Julien Minguely
 
WCBos13 intermediate workshop
WCBos13 intermediate workshopWCBos13 intermediate workshop
WCBos13 intermediate workshop
Boston WordPress
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme Review
Catch Themes
 
PluginBasicsWCNYC2014
PluginBasicsWCNYC2014PluginBasicsWCNYC2014
PluginBasicsWCNYC2014
Kiko Doran
 
Wordpress overview
Wordpress overviewWordpress overview
Wordpress overview
Plasterdog Web Design
 
The WordPress Way
The WordPress WayThe WordPress Way
The WordPress Way
Kan Ouivirach, Ph.D.
 
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
Heidi Cool
 
WordPress Theme Reviewers Team
WordPress Theme Reviewers TeamWordPress Theme Reviewers Team
WordPress Theme Reviewers Team
Mario Peshev
 
Newspapers with WordPress
Newspapers with WordPressNewspapers with WordPress
Newspapers with WordPress
Christopher Ross
 
Websites With Wordpress
Websites With WordpressWebsites With Wordpress
Websites With Wordpress
Charly Leetham
 

Similar to Custom Post Types in Depth at WordCamp Montreal (20)

WordPress can do that?!
WordPress can do that?!WordPress can do that?!
WordPress can do that?!
 
WordPress - Open Source Overview Presentation
WordPress - Open Source Overview PresentationWordPress - Open Source Overview Presentation
WordPress - Open Source Overview Presentation
 
WordPress Complete Tutorial
WordPress Complete TutorialWordPress Complete Tutorial
WordPress Complete Tutorial
 
The Flexibility of WordPress
The Flexibility of WordPressThe Flexibility of WordPress
The Flexibility of WordPress
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012
 
The WordPress University
The WordPress UniversityThe WordPress University
The WordPress University
 
Open Source CMS Playroom
Open Source CMS PlayroomOpen Source CMS Playroom
Open Source CMS Playroom
 
From WordPress With Love
From WordPress With LoveFrom WordPress With Love
From WordPress With Love
 
WordPress as a CMS
WordPress as a CMSWordPress as a CMS
WordPress as a CMS
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond blogging
 
WCBos13 intermediate workshop
WCBos13 intermediate workshopWCBos13 intermediate workshop
WCBos13 intermediate workshop
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme Review
 
PluginBasicsWCNYC2014
PluginBasicsWCNYC2014PluginBasicsWCNYC2014
PluginBasicsWCNYC2014
 
Wordpress overview
Wordpress overviewWordpress overview
Wordpress overview
 
The WordPress Way
The WordPress WayThe WordPress Way
The WordPress Way
 
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
 
WordPress Theme Reviewers Team
WordPress Theme Reviewers TeamWordPress Theme Reviewers Team
WordPress Theme Reviewers Team
 
Newspapers with WordPress
Newspapers with WordPressNewspapers with WordPress
Newspapers with WordPress
 
Websites With Wordpress
Websites With WordpressWebsites With Wordpress
Websites With Wordpress
 
WordPress Workshop
WordPress WorkshopWordPress Workshop
WordPress Workshop
 

Recently uploaded

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 

Recently uploaded (20)

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 

Custom Post Types in Depth at WordCamp Montreal

  • 1. WordPress Custom Post Types In-Depth Colin Vernon & Joachim Kudish
  • 2. Organizing Content of Different Types • It’s about Content: websites usually have content of different types: posts, pages, articles, videos, newsletters, products, books, anything • A question of content and information architecture vs data structure
  • 3. Back in the day... • Websites were simpler... ? • Created custom architecture with pages • Different content types could be “faked” with categories and category navigation
  • 4.
  • 5.
  • 6. What are custom post types? • Introduced in WordPress 2.9, much simplified in 3.0 and expanded upon in 3.1 • Classic blog format used categories to classify content • Custom post types allow for more in-depth fine-grained control and separation of content • Better name = custom content type
  • 7. Advanced uses of CPTs • Products (WP E-Commerce uses it - http://getshopped.org/) • Job Postings • Testimonials • Newsletters • Possibilities are endless!
  • 8.
  • 9.
  • 10. Registering Custom Post Types Graphical/easy way: • Plug and play, simple interfaces • Custom Post Type UI - http:// wordpress.org/extend/plugins/custom- post-type-ui/ • GD Custom Posts And Taxonomies Tools - http://wordpress.org/extend/plugins/ gd-taxonomies-tools/ • More Types - http://wordpress.org/ extend/plugins/more-types/ • Lots of other examples
  • 11.
  • 12.
  • 13.
  • 14. GRAPHICAL ≠ USER INTERFACE
  • 15. Code Method register_post_type(); • http://codex.wordpress.org/ Function_Reference/register_post_type • core function • lots of $args for lots of possibilities
  • 17. $args = customization Admin: • labels, show_ui, show_in_menu, menu_position, menu_icon, capability_type, capabilities, map_meta_cap, register_meta_box_cb, can_export, show_in_nav_menus Front-end: • public, publicly_queryable, exclude_from_search, hierarchical, taxonomies Permalinks:
  • 18. Code = Good ☺ • versionable (svn, git, etc...) • core WordPress way • easy to edit at any time • you keep full control • similar to what GUI plugins do, but without relying on the database • only a few lines of code
  • 19. Some Shortcomings of WP API • lots of repetition in the code • not good enough defaults (labels!) • now has good support for archives (since 3.1) but still no built-in support for feed permalinks, etc.
  • 20. Alternate Code Methods • Smarter Custom Post Types by Matt Wiebe: • http://somadesign.ca/projects/smarter- custom-post-types/ • now obsolete because of 3.1’s archive/ permalinks abilities • Our own SLD Custom Content & Taxonomy • https://github.com/jkudish/SLD- Custom-Post-Types-Taxonomies-for- Wordpress • wrapper plugin/class for
  • 21. Taking CPTs even further • Taxonomies • further way of classifying content • group different content types together based on taxonomies • use built-in taxonomies (categories & tags) or custom taxonomies • register custom taxonomies with code, not GUI plugins • use the core WP function register_taxonomy() http://codex.wordpress.org/ Function_Reference/register_taxonomy
  • 22.
  • 24. Taking CPTs even further • Meta fields / meta boxes / custom fields: • allow you to store any information • extremely expandable • WordPress API requires a lot of code, no good defaults: • add_meta_box() • http://codex.wordpress.org/ Function_Reference/add_meta_box
  • 25.
  • 26. Meta Boxes • similarly to content types & taxonomies, there are GUI plugins to register meta boxes • More Fields: http://wordpress.org/ extend/plugins/more-fields/ • Advanced Custom Fields: http:// wordpress.org/extend/plugins/ advanced-custom-fields/ • Verve Meta Boxes: http:// wordpress.org/extend/plugins/verve- meta-boxes/
  • 27. Easier Meta Fields • Custom Metadata Manager by Mohammad Jangda • http://wordpress.org/extend/plugins/ custom-metadata/ • easy wrapper functions for adding meta boxes and custom fields
  • 28. Custom Metadata Manager x_add_metadata_field( $slug, $object_types = 'post', $args = array() ) x_add_metadata_group( $slug, $object_types = 'post', $args = array() )
  • 29. Even Further... • complex post to post (content to content) relations • allows web app functionality à la Rails/ Django • posts 2 posts plugin: http:// wordpress.org/extend/plugins/posts-to- posts/ • different page/content templates = different set of fields
  • 30. ✔ Lessons Learned • use custom content types for anything that isn’t a blog post and isn’t a static page • if you’re a developer, don’t rely on the database to register CPTs • if you’re not a developer, hire a developer, learn to code (copy/paste) or use a plugin • best way to learn = read the codex, code and make mistakes
  • 31. Extra links • Custom post type & custom taxonomy generator: http://themergency.com/ generators/ • Joachim’s WP.org profile page (the SLD helper class plugin will appear here once it’s live): http://profiles.wordpress.org/users/ jkudish • Colin’s WP.org profile page: http:// profiles.wordpress.org/users/cvernon • WordPress.tv (recorded presentation will appear here): http://wordpress.tv/
  • 33. Thanks! Any Questions? http://stresslim.it/welovewp @stresslimit / http://stresslimitdesign.com @jkudish / http://jkudish.com

Editor's Notes

  1. both\n
  2. colin\n
  3. colin\n
  4. colin\n
  5. colin\n
  6. joey\n
  7. joey\n
  8. joey\n
  9. joey\n
  10. colin\n
  11. colin\n
  12. colin\n
  13. colin\n
  14. colin\n
  15. joey\n
  16. joey\n
  17. joey\n
  18. joey\n
  19. colin\n
  20. colin\n
  21. joey\n
  22. joey\n
  23. joey\n
  24. colin\n
  25. colin\n
  26. colin\n
  27. colin\n
  28. colin\n
  29. colin\n
  30. joey\n
  31. \n
  32. both\n
  33. both\n
  34. both\n
  35. both\n