Your SlideShare is downloading. ×
Custom post types - WordPress
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Custom post types - WordPress

5,650
views

Published on

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

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

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
5,650
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Pitched at beginner/intermediate devs\n\nSome knowledge of theme structure, some PHP\n
  • \n
  • \n
  • \n
  • \n
  • Before WP3 = hacking posts\nMessy code\nMessy admin area\n
  • CPTs make things easier for you and the client\n\nImproved workflow and productivity.\n
  • \n\n
  • Mention plugins and generators\n\nThis code is all we need to get this...\n\n
  • \n
  • Clean interface, nothing that we don’t need.\n
  • Need to add:\nPrice\nRooms\n
  • has_archive => true, if using an archive page\n
  • Remember rooms and price \n
  • Not just for CPTs.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Custom Post Types What, why and how
    • 2. Keith Devon• Freelance web designer and WordPress developer• Specialise in building custom themes and plugins• Founder of WordPress London
    • 3. What we’ll cover• What are Custom Post Types• When to use them• How to use them• Taking things further• Resources• Questions
    • 4. What are they?Think content not posts. I.e. Custom Content Types
    • 5. What are they? Examples:•Movies•Staff•Podcasts•Books•Products•Testimonials, etc, etc.
    • 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. Enter, custom post types• Cleaner UIs• Easier theme customisation• Easier to maintain and update your code
    • 8. Registering your CPTYou can do this using plugins, but...
    • 9. Registering your CPT
    • 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. Congratulations!You’ve created a custom post type.Now for even more awesomeness...
    • 12. Custom meta boxes
    • 13. Custom meta boxes• Show the code
    • 14. • Show the meta box image
    • 15. • Show the meta box image
    • 16. Custom Taxonomies Hierarchical Not hierarchical(like categories) (like tags)
    • 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. 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. Thanks for listening Any questions? @keithdevon keith@keithdevon.com www.keithdevon.com
    • 20. Follow ups• Slides will be posted on meetup.com• Video (hopefully) will be posted• @wpldn #wpldn