SlideShare a Scribd company logo
1 of 34
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 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

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

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