SlideShare a Scribd company logo
1 of 34
Download to read offline
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
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
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!
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
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
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
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
Custom Post Types in Depth at WordCamp Montreal
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
Custom Post Types in Depth at WordCamp Montreal
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 developmentTammy 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 NepalChandra 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 2011David Carr
 
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 developmentThad Allender
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017Amanda 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 WordPressadamsilverstein
 
Introduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingIntroduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingJamie 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 Designerselliotjaystocks
 
WordPress Theme Structure
WordPress Theme StructureWordPress Theme Structure
WordPress Theme Structurekeithdevon
 
Associations & JavaScript
Associations & JavaScriptAssociations & JavaScript
Associations & JavaScriptJoost Elfering
 
Javascript for the c# developer
Javascript for the c# developerJavascript for the c# developer
Javascript for the c# developerSalvatore Fazio
 
Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveAxway 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 PerlOpusVL
 

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 learnedBas van Dishoeck
 
Custom Post Types and Taxonomies
Custom Post Types and TaxonomiesCustom Post Types and Taxonomies
Custom Post Types and TaxonomiesTammy Hart
 
WordPress 3 Custom Post Types
WordPress 3 Custom Post TypesWordPress 3 Custom Post Types
WordPress 3 Custom Post TypesDave 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 ArchitectureMario 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 OptimizationJoost de Valk
 
Beginning WordPress Plugin Development
Beginning WordPress Plugin DevelopmentBeginning WordPress Plugin Development
Beginning WordPress Plugin DevelopmentAizat Faiz
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialChristos 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 PresentationAndy Stratton
 
The Flexibility of WordPress
The Flexibility of WordPressThe Flexibility of WordPress
The Flexibility of WordPressStephanie 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 LoveUp2 Technology
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond bloggingJulien Minguely
 
WCBos13 intermediate workshop
WCBos13 intermediate workshopWCBos13 intermediate workshop
WCBos13 intermediate workshopBoston WordPress
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme ReviewCatch Themes
 
PluginBasicsWCNYC2014
PluginBasicsWCNYC2014PluginBasicsWCNYC2014
PluginBasicsWCNYC2014Kiko Doran
 
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-BetweenHeidi Cool
 
WordPress Theme Reviewers Team
WordPress Theme Reviewers TeamWordPress Theme Reviewers Team
WordPress Theme Reviewers TeamMario Peshev
 
Websites With Wordpress
Websites With WordpressWebsites With Wordpress
Websites With WordpressCharly 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

AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024Brian Pichman
 
The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)IES VE
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4DianaGray10
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...DianaGray10
 
IT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingIT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingMAGNIntelligence
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdfThe Good Food Institute
 
Graphene Quantum Dots-Based Composites for Biomedical Applications
Graphene Quantum Dots-Based Composites for  Biomedical ApplicationsGraphene Quantum Dots-Based Composites for  Biomedical Applications
Graphene Quantum Dots-Based Composites for Biomedical Applicationsnooralam814309
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Alkin Tezuysal
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechProduct School
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxNeo4j
 
Introduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationIntroduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationKnoldus Inc.
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0DanBrown980551
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosErol GIRAUDY
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfInfopole1
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024Brian Pichman
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxSatishbabu Gunukula
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kitJamie (Taka) Wang
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3DianaGray10
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1DianaGray10
 

Recently uploaded (20)

AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024
 
The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...
 
IT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced ComputingIT Service Management (ITSM) Best Practices for Advanced Computing
IT Service Management (ITSM) Best Practices for Advanced Computing
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf
 
Graphene Quantum Dots-Based Composites for Biomedical Applications
Graphene Quantum Dots-Based Composites for  Biomedical ApplicationsGraphene Quantum Dots-Based Composites for  Biomedical Applications
Graphene Quantum Dots-Based Composites for Biomedical Applications
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
 
Introduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationIntroduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its application
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenarios
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdf
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptx
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kit
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1
 

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
  • 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!
  • 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
  • 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
  • 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
  • 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