Pitched at beginner/intermediate devs\n\nSome knowledge of theme structure, some PHP\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
Mention plugins and generators\n\nThis code is all we need to get this...\n\n
Clean interface, nothing that we don&#x2019;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
Custom post types - WordPress
Custom Post Types What, why and how
Keith Devon• Freelance web designer and WordPress developer• Specialise in building custom themes and plugins• Founder of WordPress London
What we’ll cover• What are Custom Post Types• When to use them• How to use them• Taking things further• Resources• Questions
What are they?Think content not posts. I.e. Custom Content Types
What are they? Examples:•Movies•Staff•Podcasts•Books•Products•Testimonials, etc, etc.
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
Enter, custom post types• Cleaner UIs• Easier theme customisation• Easier to maintain and update your code
Registering your CPTYou can do this using plugins, but...
Custom Taxonomies Hierarchical Not hierarchical(like categories) (like tags)
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/
Now you know:• What a custom post type is• When to use them• That it’s simple to implement• It makes your life easier!
Thanks for listening Any questions? @keithdevon email@example.com www.keithdevon.com
Follow ups• Slides will be posted on meetup.com• Video (hopefully) will be posted• @wpldn #wpldn