Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Custom post types - WordPress

6,197 views

Published on

Keith Devon gives a presentation to the WordPress London group about custom post types in WordPress.

For video and article, see http://keithdevon.com/2011/tuts/custom-post-types/.

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

Custom post types - WordPress

  1. 1. Custom Post Types What, why and how
  2. 2. Keith Devon• Freelance web designer and WordPress developer• Specialise in building custom themes and plugins• Founder of WordPress London
  3. 3. What we’ll cover• What are Custom Post Types• When to use them• How to use them• Taking things further• Resources• Questions
  4. 4. What are they?Think content not posts. I.e. Custom Content Types
  5. 5. What are they? Examples:•Movies•Staff•Podcasts•Books•Products•Testimonials, etc, etc.
  6. 6. When to use them? An example: “I want to create a website for my holiday home rentals company. I have a portfolio of 20 properties that I want to be able to manage and update. Each property has the following information:”• Name• Price per week• Number of rooms• Short intro• Full property description• An image
  7. 7. Enter, custom post types• Cleaner UIs• Easier theme customisation• Easier to maintain and update your code
  8. 8. Registering your CPTYou can do this using plugins, but...
  9. 9. Registering your CPT
  10. 10. Template files• single-$posttype.php• archive-$posttype.php• Replace $posttype with the variable name of your CPT.• E.g. single-kdev_properties.php
  11. 11. Congratulations!You’ve created a custom post type.Now for even more awesomeness...
  12. 12. Custom meta boxes
  13. 13. Custom meta boxes• Show the code
  14. 14. • Show the meta box image
  15. 15. • Show the meta box image
  16. 16. Custom Taxonomies Hierarchical Not hierarchical(like categories) (like tags)
  17. 17. Resourceshttp://codex.wordpress.org/Post_Typeshttp://codex.wordpress.org/Function_Reference/register_post_typePluginshttp://wordpress.org/extend/plugins/custom-post-type-ui/http://wordpress.org/extend/plugins/custom-content-type-manager/Postshttp://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpresshttp://devpress.com/blog/conditional-checks-for-custom-post-types/http://css-tricks.com/forums/discussion/8538/wordpress-3.0-custom-post-types-and-meta-boxes/Easy meta boxes with WPAlchemyhttp://www.farinspace.com/wpalchemy-metabox/
  18. 18. Now you know:• What a custom post type is• When to use them• That it’s simple to implement• It makes your life easier!
  19. 19. Thanks for listening Any questions? @keithdevon keith@keithdevon.com www.keithdevon.com
  20. 20. Follow ups• Slides will be posted on meetup.com• Video (hopefully) will be posted• @wpldn #wpldn

×