• Like
  • Save
Custom Post Types in Depth at WordCamp Montreal
Upcoming SlideShare
Loading in...5
×
 

Custom Post Types in Depth at WordCamp Montreal

on

  • 5,596 views

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

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.

Statistics

Views

Total Views
5,596
Views on SlideShare
5,520
Embed Views
76

Actions

Likes
5
Downloads
48
Comments
3

12 Embeds 76

http://www.techgig.com 42
http://paper.li 8
url_unknown 5
http://lanyrd.com 5
http://coderwall.com 5
http://timesjobs.techgig.com 3
http://127.0.0.1 2
http://twitter.com 2
http://www.slideshare.net 1
http://us-w1.rockmelt.com 1
https://twitter.com 1
http://www.linkedin.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

13 of 3 Post a comment

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Hi there, this is great site, I stumbled today on one more that I'd like to share with you. It is similar and well explained all about Post Nasal Drip
    Are you sure you want to
    Your message goes here
    Processing…
  • Muy Bueno!
    Are you sure you want to
    Your message goes here
    Processing…
  • Great introductory breakdown of Custom Post Types.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 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

Custom Post Types in Depth at WordCamp Montreal Custom Post Types in Depth at WordCamp Montreal Presentation Transcript

  • 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, 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 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
  • Advanced uses of CPTs• Products (WP E-Commerce uses it - http://getshopped.org/)• Job Postings• Testimonials• Newsletters• Possibilities are endless!
  • 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
  • GRAPHICAL ≠ USERINTERFACE
  • 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 = 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:
  • 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 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.
  • 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 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
  • http://pastie.org/2170028
  • 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
  • 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 MetadataManagerx_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?