Hazlitt Eastman at WP-Brighton 2011 - WordPress Custom Post Types

760 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
760
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Hazlitt Eastman at WP-Brighton 2011 - WordPress Custom Post Types

  1. 1. Diving into Wordpress Custom Post Types Hazlitt Eastman www.manta9.com @hazlitteastmanWordpress theme and plugin development, Codeigniter, PHP / MySQL / Javascript / HTML / CSS
  2. 2. What are we going to look at?- What are Custom Post Types?- Web site example- Useful plugins- Code www.manta9.com @hazlitteastman
  3. 3. What are Custom Post Types?Provide a method by which we can structure differenttypes of website content. (not just Posts and Pages)Examples: - Adverts - DVDs - Books - Testimonials - Tour dates www.manta9.com @hazlitteastman
  4. 4. Website Front End Examplewww.offthekerb.co.ukContains 11 Custom Post Types www.manta9.com @hazlitteastman
  5. 5. Useful Plugins- Can be created in functions.php using the register_post_type() Wordpress function- Custom Post Type UI- Verve Metabox- More Fields- Advanced Custom Fields www.manta9.com @hazlitteastman
  6. 6. Website Back End Examplewww.offthekerb.co.uk- As an Editor- As an Administrator www.manta9.com @hazlitteastman
  7. 7. Code example using query_posts()query_posts( posts_per_page=-1&post_type=dvds); if(have_posts()) : while(have_posts()) : the_post(); //loop opened $image = get_post_meta($post->ID, image_2, true); $link = get_post_meta($post->ID, link_2, true); $title = get_the_title(); echo "<li>n"; echo "<a href="http://" . $link . "" target="_blank"><img src="" .$image . "" alt="" . $title. "" /></a>n"; echo "</li>n"; endwhile; //loop closed endif; //have_posts closed www.manta9.com @hazlitteastman
  8. 8. What have we looked at?- What are Custom Post Types?- Web site example- Useful plugins- Code www.manta9.com @hazlitteastman
  9. 9. Diving into Wordpress Custom Post Types Questions... www.manta9.com @hazlitteastman

×