Your SlideShare is downloading. ×
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
Custom Post Types - WordPress
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,981

Published on

Presentation at WordCamp San Diego 2012

Presentation at WordCamp San Diego 2012

Published in: Technology
1 Comment
7 Likes
Statistics
Notes
No Downloads
Views
Total Views
5,981
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
1
Comments
1
Likes
7
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

Transcript

  • 1. Custom Post Types and Taxonomies Jared Atchison WordPress Developer & Consultant jaredatchison.com / @jaredatch3/24/12 Custom Post Types and Taxonomies 1
  • 2. Just who the hell is this guy? ABOUT ME3/24/12 Custom Post Types and Taxonomies 2
  • 3. About Me• 2008 Texas A&M graduate (whoop)• WordPress developer & consultant• Featured Genesis developer• Listed CodePoet• WordCamp speaker and attendee• Plugin author• Custom Metaboxes co-author (CustomMetaboxes.com)• bbPress contributor, forum moderator3/24/12 Custom Post Types and Taxonomies 3
  • 4. Let’s begin… CUSTOM POST TYPES3/24/12 Custom Post Types and Taxonomies 4
  • 5. First, a quick poll.• DO YOU KNOW?• DO YOU USE?3/24/12 Custom Post Types and Taxonomies 5
  • 6. 3/24/12 Custom Post Types and Taxonomies 6
  • 7. What the @#$*! is a Custom Post Type? Also referred to as CPTs3/24/12 Custom Post Types and Taxonomies 7
  • 8. CPTs - from the Codex“WordPress can hold and display many different types ofcontent. Internally, these are all stored in the same place,in the wp_posts table.These are differentiated by a column called post_type.WordPress 3.0 gives you the capability to add your owncustom post types and to use them in different ways.”http://codex.wordpress.org/Post_Types3/24/12 Custom Post Types and Taxonomies 8
  • 9. WP Default Custom Post Types• Post• Page• Attachment• Revisions• Nav Menus3/24/12 Custom Post Types and Taxonomies 9
  • 10. register_post_type()add_action( init, create_post_type );function create_post_type() { register_post_type( acme_product, array( labels => array( name => __( Products ), singular_name => __( Product ) ), public => true, has_archive => true, ) );}http://codex.wordpress.org/Function_Reference/register_post_type3/24/12 Custom Post Types and Taxonomies 10
  • 11. BOOM.3/24/12 Custom Post Types and Taxonomies 11
  • 12. You should really check out the Codex. No Really.• Naming best practices• Reserved names• Admin UI• URLs• CPT templates• Available $args http://codex.wordpress.org/Post_Types http://codex.wordpress.org/Function_Reference/register_post_type3/24/12 Custom Post Types and Taxonomies 12
  • 13. How and when? A PSA ON REGISTERING CPTS3/24/12 Custom Post Types and Taxonomies 13
  • 14. Register when appropriate…• If at all possible – “Core Functionality” plugin• http://wpcandy.com/teaches/how-to-create-a-functionality-plugin• http://ottopress.com/2011/creating-a-site-specific-snippets-plugin/• http://www.billerickson.net/core-functionality-plugin/3/24/12 Custom Post Types and Taxonomies 14
  • 15. How? Check. Where? Check. WHEN?3/24/12 Custom Post Types and Taxonomies 15
  • 16. WITH GREAT POWER COMES GREAT RESPONSIBILITY3/24/12 Custom Post Types and Taxonomies 16
  • 17. THINK ABOUT HOW IT WILL BE USED AND WHAT IT NEEDS3/24/12 Custom Post Types and Taxonomies 17
  • 18. Example• Books• Will it be setup different than posts?• Custom metaboxes?• Separate taxonomies (authors, genres, rating, price)• Separate queries• Archive page• No? ?3/24/12 Custom Post Types and Taxonomies 18
  • 19. Further reading… http://ottopress.com/2010/wordpress-3-0-and-custom-post-types/3/24/12 Custom Post Types and Taxonomies 19
  • 20. 3/24/12 Custom Post Types and Taxonomies 20
  • 21. (by popular demand)3/24/12 Custom Post Types and TaxonomiesCustom Post Types and Taxonomies 21
  • 22. Books http://popcritics.com/books/professional-wordpress-plugin-development3/24/12 Custom Post Types and Taxonomies 22
  • 23. Movies http://popcritics.com/movies/avatar3/24/12 Custom Post Types and Taxonomies 23
  • 24. Movies (cont.) http://popcritics.com/movies3/24/12 Custom Post Types and Taxonomies 24
  • 25. Beating a dead horse. SLIDERS, SLIDESHOWS, ROTATORS.3/24/12 Custom Post Types and Taxonomies 25
  • 26. Generally there are two different methods used for a “slideshow” custom post type…3/24/12 Custom Post Types and TaxonomiesCustom Post Types and Taxonomies 26
  • 27. First method• The entire post type is one slideshow• Each entry (post) is a slide• Featured image is the slide image• hierarchial=false (register cpt)• orderby=menu_order (wp_query)• Fancy AJAX re-ordering, eg: http://wordpress.org/extend/plugins/simple-page-ordering/3/24/12 Custom Post Types and Taxonomies 27
  • 28. First method – back end3/24/12 Custom Post Types and Taxonomies 28
  • 29. First method – front end3/24/12 Custom Post Types and Taxonomies 29
  • 30. Second method• Each entry (post) is a complete slideshow• Usually has a shortcode system eg [slideshow id=21]• Often has more bells and whistles, though can be more work to customize3/24/12 Custom Post Types and Taxonomies 30
  • 31. Second method – back end http://soliloquywp.com/3/24/12 Custom Post Types and Taxonomies 31
  • 32. … last one… I promise http://soliloquywp.com/3/24/12 Custom Post Types and Taxonomies 32
  • 33. Let people know other people like you. TESTIMONIALS3/24/12 Custom Post Types and Taxonomies 33
  • 34. 3/24/12 Custom Post Types and Taxonomies 34
  • 35. 3/24/12 Custom Post Types and Taxonomies 35
  • 36. 3/24/12 Custom Post Types and Taxonomies 36
  • 37. Wait for it… FAQ3/24/12 Custom Post Types and Taxonomies 37
  • 38. http://wordpress.org/extend/plugins/wordpress-faq-manager/3/24/12 Custom Post Types and Taxonomies 38
  • 39. Show clients why you are awesome. PORTFOLIO3/24/12 Custom Post Types and Taxonomies 39
  • 40. 3/24/12 Custom Post Types and Taxonomies 40
  • 41. 3/24/12 Custom Post Types and Taxonomies 41
  • 42. Getting deeper…3/24/12 Custom Post Types and Taxonomies 42
  • 43. Track down leads. CRM3/24/12 Custom Post Types and Taxonomies 43
  • 44. 3/24/12 Custom Post Types and Taxonomies 44
  • 45. 3/24/12 Custom Post Types and Taxonomies 45
  • 46. 3/24/12 Custom Post Types and Taxonomies 46
  • 47. http://wordpress.org/extend/plugins/front-end-editor/ https://github.com/billerickson/Genesis-CRM https://github.com/jaredatch3/24/12 Custom Post Types and Taxonomies 47
  • 48. Full fledged forums. bbPress (2.x)3/24/12 Custom Post Types and Taxonomies 48
  • 49. bbPress• One of the most advanced examples of CPTs• Go for 2.x• Loads of trickery• Forums = CPT• Topics (threads) = CPT• Replies = CPT• Topic tags = custom taxonomies3/24/12 Custom Post Types and Taxonomies 49
  • 50. THREE CPTS? WAT?3/24/12 Custom Post Types and Taxonomies 50
  • 51. Question3/24/12 Custom Post Types and Taxonomies 51
  • 52. Answer3/24/12 Custom Post Types and Taxonomies 52
  • 53. bbPress in the wild• www.makeupgeek.com/forums/• www.getshopped.org/forums/• www.wpcandy.com/forums/3/24/12 Custom Post Types and Taxonomies 53
  • 54. Other CPT examples…• Coupons• Events (Events Calendar Pro)• Products (WooCommerce)• URL Redirection (Simple URLs)• Bookmarks (formerly like delicious)• Tutorials3/24/12 Custom Post Types and Taxonomies 54
  • 55. QUESTIONS? FIND ME. Jared Atchison WordPress Developer & Consultant jaredatchison.com / @jaredatch3/24/12 Custom Post Types and Taxonomies 55

×