Your SlideShare is downloading. ×
0
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
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

Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson

2,308

Published on

http://www.fallingupmedia.com …

http://www.fallingupmedia.com
By now a lot of us have heard about or used the amazing custom post type functionality within WordPress. But, after the code has settled from registering your very own custom post type, what do you do next? This session will focus on some of the intermediate to advanced practices and abilities to leverage custom post types to the max. You can literally build anything you can imagine with custom post type support through WordPress, and hopefully with some of the knowledge from this session, you will be armed with the tools to let your imagination and creativity run wild. So what are the topics in store?

- Adding custom taxonomies to your post type
– Brief overview of custom taxonomies
– The code
– Great Examples
- Custom admin columns for your post type
– Brief overview and why this is important
– The Code
– Great Examples
- Post type specific page templates
– How to create custom page templates for your post type
- Custom fields
– Every custom post type could use a specific custom field
– How we do it
– Oh the possibilities!
- Custom Queries
– Brief overview
– Great examples

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,308
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
10
Comments
0
Likes
3
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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. 1 Custom Post Types Now What? By Cody Helgeson WordCamp Phoenix 2012 @codyhelgeson | @fallingupmedia | #wcphx
    • 2. 2 Find More Info Who Am I? My Experience with WordPress @codyhelgeson @fallingupmedia fallingupmedia.com cody@fallingupmedia.com @codyhelgeson | @fallingupmedia | #wcphx
    • 3. 3 Topics For The Day • Custom Post Type Best Practices • Custom Taxonomies • Page Templates • Custom Fields • Custom Admin Columns • Custom Queries @codyhelgeson | @fallingupmedia | #wcphx
    • 4. 4 Custom Post Types • Who has or is about to use custom post types? • Why use custom post types • Why not? • For the client • For the developer @codyhelgeson | @fallingupmedia | #wcphx
    • 5. 5 Custom Post Types Examples • Book and Product Reviews • Job and Business Listings • Events and Locations • Portfolios and Case Studies • Combine with BuddyPress for Community Domination! • Anything your Heart Desires.... @codyhelgeson | @fallingupmedia | #wcphx
    • 6. 6 Custom Post Types The Code http://codex.wordpress.org/Function_Reference/register_post_type • Contextual help menus are a nice touch • Permalinks matter! • Flush the rewrite rules, or save permalink settings • /%category%/%postname%/ • www.domain.com/custom-post-type/post-title @codyhelgeson | @fallingupmedia | #wcphx
    • 7. 7 Topics For The Day • Custom Post Type Best Practices • Custom Taxonomies • Page Templates • Custom Fields • Custom Admin Columns • Custom Queries @codyhelgeson | @fallingupmedia | #wcphx
    • 8. 8 Custom Taxonomies http://codex.wordpress.org/Taxonomies • Categorizes and groups content • Hierarchal or not? I.E. tags or categories • Clean and intuitive for users • Custom slugs argument • Create custom page templates and queries @codyhelgeson | @fallingupmedia | #wcphx
    • 9. 9 Custom Taxonomies The Code http://codex.wordpress.org/Function_Reference/register_taxonomy • Flush rewrite or save permalink settings • There are reserved terms! • register_taxonomy($taxonomy, $object_type, $args);  @codyhelgeson | @fallingupmedia | #wcphx
    • 10. 10 Topics For The Day Custom Post Types • Custom Post Type Best Practices • Custom Taxonomies • Page Templates • Custom Fields • Custom Admin Columns • Custom Queries @codyhelgeson | @fallingupmedia | #wcphx
    • 11. 11 Page Templates http://codex.wordpress.org/Template_Hierarchy • WordPress makes it easy! Use them! • single-post_type.php • archive-post_type.php • taxonomy-taxonomy_name-slug.php • taxonomy-taxonomy_name.php @codyhelgeson | @fallingupmedia | #wcphx
    • 12. 12 Topics For The Day Custom Post Types • Custom Post Type Best Practices • Custom Taxonomies • Page Templates • Custom Fields • Custom Admin Columns • Custom Queries @codyhelgeson | @fallingupmedia | #wcphx
    • 13. 13 Custom Fields http://codex.wordpress.org/Custom_Fields • Purely incredible! Endless possibilities • Remove what you don’t need from editor. Take the time • Create your own or use a plugin • Advanced Custom Fields plugin • Magic Fields plugin • get_post_meta - add_post_meta @codyhelgeson | @fallingupmedia | #wcphx
    • 14. 14 Custom Fields Examples • Real world examples on the web...... @codyhelgeson | @fallingupmedia | #wcphx
    • 15. 15 Topics For The Day Custom Post Types • Custom Post Type Best Practices • Custom Taxonomies • Page Templates • Custom Fields • Custom Admin Columns • Custom Queries @codyhelgeson | @fallingupmedia | #wcphx
    • 16. 16 Custom Admin Columns The Code http://codex.wordpress.org/Plugin_API/Action_Reference/ manage_posts_custom_column http://codex.wordpress.org/Plugin_API/Filter_Reference/ manage_edit-post_type_columns add_action("manage_posts_custom_column", "your_custom_post_column_function"); add_filter("manage_edit-$post_type_columns", "your_custom_column_function"); @codyhelgeson | @fallingupmedia | #wcphx
    • 17. 17 http://blog.elliotcondon.com/wordpress/advanced-custom-fields- admin-custom-columns/ function my_page_columns($columns) { " $columns = array( " " cb" " => <input type="checkbox" />, " " thumbnail" =>"Thumbnail, " " title " => Title, " " featured "=> Featured, " " author" =>"Author, " " date" " =>"Date, " ); " return $columns; } @codyhelgeson | @fallingupmedia | #wcphx
    • 18. 18 function my_custom_columns($column) { " global $post; " if($column == thumbnail) " { " " echo wp_get_attachment_image( get_field(page_image, $post->ID), array(200,200) ); " } " elseif($column == featured) " { " " if(get_field(featured)) " " { " " " echo Yes; " " } " " else " " { " " " echo No; " " } " } }   add_action("manage_pages_custom_column", "my_custom_columns"); add_filter("manage_edit-page_columns", "my_page_columns"); @codyhelgeson | @fallingupmedia | #wcphx
    • 19. 19 Custom Admin Columns Examples @codyhelgeson | @fallingupmedia | #wcphx
    • 20. 20 http://www.trymypoolguy.com function my_post_columns_forums($columns) { " $columns = array( " " cb" " => <input type="checkbox" />, " " title " => Listing Title, " " featured" => Featured, " " author => Author, " " comments => <img src="image_path_goes_here" />, " " zips => Zip Code, " " services => Services, " " repairs => Repairs, " " date" " => Date, " ); " return $columns; } @codyhelgeson | @fallingupmedia | #wcphx
    • 21. 21 function my_custom_columns_forums($column) { " global $post; " if($column == featured) " { " " if(get_field(featured)) " " { " " " echo <strong>Yes</strong>; " " } " " else " " { " " " echo ; " " } " } " if($column == zips) " { " " echo get_field(zip_code, $post->ID); " } " if($column == services) " { " $custom_fields = get_post_custom($post->ID); " $my_custom_field = $custom_fields[services]; " foreach ( $my_custom_field as $key => $value ) " echo $value . "<br />"; " } " if($column == repairs) " { " $custom_fields = get_post_custom($post->ID); " $my_custom_field = $custom_fields[repairs]; " foreach ( $my_custom_field as $key => $value ) " echo $value . "<br />"; " }
    • 22. 22 Custom Admin Columns Examples @codyhelgeson | @fallingupmedia | #wcphx
    • 23. 23 Topics For The Day Custom Post Types • Custom Post Type Best Practices • Custom Taxonomies • Page Templates • Custom Fields • Custom Admin Columns • Custom Queries @codyhelgeson | @fallingupmedia | #wcphx
    • 24. 24 Custom Queries http://codex.wordpress.org/Template_Tags/get_posts http://codex.wordpress.org/Class_Reference/WP_Query • get_posts • does not modify global variables • wp_query • always <?php wp_reset_query(); ?> @codyhelgeson | @fallingupmedia | #wcphx
    • 25. 25 Custom Queries get posts from: custom post type - dogfood and category = brand <?php $args = array( numberposts => 8, orderby => rand, post_type => dogfood, dogfood_category => brand, post_status => publish ); $show_brands = get_posts ( $args ); ?> @codyhelgeson | @fallingupmedia | #wcphx
    • 26. 26 Custom Queries Examples • Real world examples on the web...... @codyhelgeson | @fallingupmedia | #wcphx
    • 27. 27 Thank You! @codyhelgeson @fallingupmedia fallingupmedia.com cody@fallingupmedia.com @codyhelgeson | @fallingupmedia | #wcphx
    • 28. 28 Custom Post Types Now What? By Cody Helgeson WordCamp Phoenix 2012 @codyhelgeson | @fallingupmedia | #wcphx

    ×