Your SlideShare is downloading. ×
0
WordPress Custom Post Types In-Depth    Colin Vernon & Joachim Kudish
Organizing Content ofDifferent Types•   It’s about Content: websites usually have    content of different types: posts, pa...
Back in the day... •   Websites were simpler... ? •   Created custom architecture with pages •   Different content types c...
What are custom posttypes?•   Introduced in WordPress 2.9, much    simplified in 3.0 and expanded upon in 3.1•   Classic bl...
Advanced uses of CPTs•   Products (WP E-Commerce uses it -    http://getshopped.org/)•   Job Postings•   Testimonials•   N...
Registering Custom PostTypes Graphical/easy way:  •   Plug and play, simple interfaces  •   Custom Post Type UI - http:// ...
GRAPHICAL  ≠   USERINTERFACE
Code Method register_post_type();  •   http://codex.wordpress.org/      Function_Reference/register_post_type  •   core fu...
http://pastie.org/2169751 (taken from the WP Codex)
$args = customizationAdmin: •   labels, show_ui, show_in_menu,     menu_position, menu_icon,     capability_type, capabili...
Code = Good ☺•   versionable (svn, git, etc...)•   core WordPress way•   easy to edit at any time•   you keep full control...
Some Shortcomings ofWP API •   lots of repetition in the code •   not good enough defaults (labels!) •   now has good supp...
Alternate Code Methods•   Smarter Custom Post Types by Matt Wiebe:    •   http://somadesign.ca/projects/smarter-        cu...
Taking CPTs evenfurther•   Taxonomies    •   further way of classifying content    •   group different content types toget...
http://pastie.org/2170028
Taking CPTs evenfurther•   Meta fields / meta boxes / custom fields:    •   allow you to store any information    •   extrem...
Meta Boxes•   similarly to content types & taxonomies,    there are GUI plugins to register meta    boxes    •   More Fiel...
Easier Meta Fields •   Custom Metadata Manager by Mohammad     Jangda •   http://wordpress.org/extend/plugins/     custom-...
Custom MetadataManagerx_add_metadata_field( $slug, $object_types = post, $args = array() )x_add_metadata_group( $slug, $obj...
Even Further...•   complex post to post (content to content)    relations    •   allows web app functionality à la Rails/ ...
✔ Lessons Learned•   use custom content types for anything that    isn’t a blog post and isn’t a static page•   if you’re ...
Extra links •   Custom post type & custom taxonomy     generator: http://themergency.com/     generators/ •   Joachim’s WP...
Thanks!Any Questions?
Thanks!       Any Questions?http://stresslim.it/welovewp@stresslimit /   http://stresslimitdesign.com@jkudish /   http://j...
Thanks!Any Questions?
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
Upcoming SlideShare
Loading in...5
×

Custom Post Types in Depth at WordCamp Montreal

5,480

Published on

Since WordPress 3.0 added Custom Post Types, WordPress has become a truly powerful and extensible Content Management System for any need. In this talk we’ll review the what, why and how of custom post types. If you’ve been meaning to learn beyond the basics of Custom Post Types, now is the time!

Starting with what CPTs are and how they’re used, we’ll explain how to register/create them as well as how make them most of them in your themes and plugins. We’ll discuss the Custom Post Types API as well as its shortcomings, and consider various UI-based CPT plugins and their pros and cons as well other innovative approaches. Custom Post Types are the future of WordPress, don’t miss out!

Basic knowledge of WordPress coding standards & PHP. HTML/CSS helpful but not required.


About Colin and Joachim
Co-founder of stresslimit, Colin has consulted on, architected and developed CMS platforms, intranets, applications and websites of all shapes & sizes for over a decade. Having watched the WordPress project be born, grow & develop, he now champions the simplicity and extensibility of the world’s most popular blogging (and now CMS) platform. Follow @stresslimit on Twitter.

Joachim created his first website at the age of 11. Ever since, he’s been passionate about all things web and has given himself the technical know-how to develop websites. In 2008, he tried out WordPress, and fell in love with the platform, and is happy to have seen it grow to where it is today. Referred to as the “WordPress guru” in the office, Joachim is now one of the lead developers at stresslimit, as well as a WordPress freelance developer. Follow @jkudish on Twitter.

Published in: Technology, Business
2 Comments
5 Likes
Statistics
Notes
No Downloads
Views
Total Views
5,480
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
52
Comments
2
Likes
5
Embeds 0
No embeds

No notes for slide
  • both\n
  • colin\n
  • colin\n
  • colin\n
  • colin\n
  • joey\n
  • joey\n
  • joey\n
  • joey\n
  • colin\n
  • colin\n
  • colin\n
  • colin\n
  • colin\n
  • joey\n
  • joey\n
  • joey\n
  • joey\n
  • colin\n
  • colin\n
  • joey\n
  • joey\n
  • joey\n
  • colin\n
  • colin\n
  • colin\n
  • colin\n
  • colin\n
  • colin\n
  • joey\n
  • \n
  • both\n
  • both\n
  • both\n
  • both\n
  • Transcript of "Custom Post Types in Depth at WordCamp Montreal"

    1. 1. WordPress Custom Post Types In-Depth Colin Vernon & Joachim Kudish
    2. 2. Organizing Content ofDifferent 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. 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. 4. What are custom posttypes?• 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
    5. 5. Advanced uses of CPTs• Products (WP E-Commerce uses it - http://getshopped.org/)• Job Postings• Testimonials• Newsletters• Possibilities are endless!
    6. 6. Registering Custom PostTypes 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
    7. 7. GRAPHICAL ≠ USERINTERFACE
    8. 8. Code Method register_post_type(); • http://codex.wordpress.org/ Function_Reference/register_post_type • core function • lots of $args for lots of possibilities
    9. 9. http://pastie.org/2169751 (taken from the WP Codex)
    10. 10. $args = customizationAdmin: • 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_menusFront-end: • public, publicly_queryable, exclude_from_search, hierarchical, taxonomiesPermalinks:
    11. 11. 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
    12. 12. Some Shortcomings ofWP 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.
    13. 13. 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
    14. 14. Taking CPTs evenfurther• 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
    15. 15. http://pastie.org/2170028
    16. 16. Taking CPTs evenfurther• 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
    17. 17. 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/
    18. 18. 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
    19. 19. Custom MetadataManagerx_add_metadata_field( $slug, $object_types = post, $args = array() )x_add_metadata_group( $slug, $object_types = post, $args = array() )
    20. 20. 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
    21. 21. ✔ 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
    22. 22. 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/
    23. 23. Thanks!Any Questions?
    24. 24. Thanks! Any Questions?http://stresslim.it/welovewp@stresslimit / http://stresslimitdesign.com@jkudish / http://jkudish.com
    25. 25. Thanks!Any Questions?
    1. A particular slide catching your eye?

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

    ×