WordPress 3.0<br />Andrew Nacin<br />WordPress Core Developer<br />twitter @nacinweb andrewnacin.com<br />email andrewnaci...
Make sure WP_CACHE is true. Props nacin.<br />
PHP 5.22011 Q2WordPress 3.2<br />
In nine weeks,WordPress 3.0was downloaded12,654,147 times<br />http://wordpress.org/download/counter/<br />
WordPresspowers8.5 percent of the web<br />Acquia<br />
WordPressis a CMS<br />
Custompost types<br />Customtaxonomies<br />Theme development<br />The mergeof WPMU<br />Why WordPress is a CMS<br />3.0<b...
Custompost types<br />Customtaxonomies<br />Theme development<br />The mergeof WPMU<br />Why WordPress is a CMS<br />
blog<br />site<br />
a post type isacontent type<br />
What can post types be used for?<br />Everything.<br />
Core post types<br />Posts<br />Pages<br />Attachments<br />Revisions<br />Menu Items<br />
They are your content and storage.<br />Blog<br />Articles<br />News Releases<br />Portfolio<br />Products<br />Newsletter...
Why?<br />Some use cases are obvious.<br />Articles, Newsletters, Portfolio, Events<br />Some are not.<br />Logging, Menu ...
Leverage what WordPressdoes best<br />Performance<br />No direct queries<br />Utilize caching<br />Extremely light<br />Sc...
Leverage existing features<br />What can posts have?<br />Title, content, excerpt<br />Author<br />Categories, tags<br />R...
Let’s put it together<br />add_action( 'init', 'my_employees_init' );<br />function my_employees_init() {<br />register_po...
What’s it look like?<br />
Editing me<br />
Let’s create a quick template<br />query_posts( array('post_type' => 'my_employee') );<br />if ( have_posts() ) :<br />whi...
Done.<br />/team/<br />/team/andrew-nacin/<br />/blog/author/andrew-nacin/<br />(excuse my CSS)<br />
Custom taxonomiesdescribe your content.<br />
Core taxonomies<br />Post Tags<br />Categories<br />Link Categories<br />Menus<br />
They describe your content.<br />The difference between tags and categories is hierarchy.<br />Topics<br />People<br />Cit...
Custom taxonomies are not new<br />Database schema — WP 2.3, Sept. 2007<br />Custom taxonomies — WP 2.5, March 2008<br />P...
Specialties taxonomy<br />register_taxonomy( 'my_specialties', 'nacin_employee', array(<br />'labels' => array(<br />'name...
Edit screen<br />
'hierarchical' => 'false'<br />
'hierarchical' => 'true'<br />
WordPress 3.0 makestheme development and customizations easier.<br />
Admin UI screenshot<br />
How?<br />In our themefunctions.php:<br />function my_theme_setup() {<br />add_custom_background();<br />}<br />add_action...
function my_theme_setup() {<br />add_custom_background();<br />define( 'NO_HEADER_TEXT', true );<br />define( 'HEADER_IMAG...
Custom Header, cont.<br />function my_theme_admin_header_style() {<br />echo '#headimg { height: ' .     HEADER_IMAGE_HEIG...
Menus<br />Screenshot of menu admin<br />
In our themefunctions.php:<br />function my_theme_setup() {<br />add_custom_background();<br />add_custom_header( 'my_them...
Menus<br />Screenshot of menus in Twenty Ten<br />
Evolving Theme Development<br />get_template_part()<br />It’s basicallyinclude()on steroids.<br />Example:<br />get_templa...
get_template_part('header', 'home');<br />Is like calling:<br />get_header( 'home' );<br />Same deal: header-home.php,then...
What’s with thetheme improvements?In 3.0, we weretheme developers.<br />
Kubrick!<br />
Twenty Ten<br />
Power one site or 10 million.<br />
WordPress Multisite<br />The WPMU fork was merged<br />Massive merge sprint, followed by cleanup<br />Terminology/concept ...
Oh no, please don’t.<br />define( 'WP_ALLOW_MULTISITE', true ); <br />
Only if you insist.<br />
A new Network Admin<br />New MU screen<br />
Other cool features<br />Pick a username/password during install<br />comment_form() and wp_login_form()<br />Stronger aut...
Follow along<br />#wordpress-dev on freenode.net<br />http://wpdevel.wordpress.com<br />http://core.trac.wordpress.org<br ...
What might be next<br />Column sorting and a more AJAX feel<br />More features for custom post types and custom taxonomies...
Our philosophies.<br />codex.wordpress.org/Release_Philosophy<br />
Decisions, not options.<br />
Preferences have a cost.<br />Too many means you can't find any of them.<br />They damage QA and testing.<br />They make g...
The quality of an interface design is inversely proportional to the number of designers.<br />
If you're too lazy to do the homework and think through the big-picture rationale, I'm too lazy to add the feature.<br />
In the presence of good rationale, maintainers should be willing to change their mind often.<br />
Let’s talk           security.<br />
QualysBlindElephant<br />BlindElephantis a web application fingerprinter.<br />Drupal, Joomla!, Liferay, Mediawiki, Moodle...
96 percent<br />JOOMLA 1.5.20<br />Versions < 1.0.15 and < 1.5.17 are critically insecure. Version 1.5.17 was released 3 m...
69 percent (and up)<br />DRUPAL 6.19<br />Versions < 5.22 and < 6.16 are critically insecure. Version 6.16 was released in...
4 percent<br />WORDPRESS 3.0.1<br />Versions < 2.5.1 are critically insecure. (Released in April 2008.)Versions < 2.8.3 ar...
Shared hosts suck.<br />
security@wordpress.org<br />
pre-release candidates for 3.0 were downloaded 75,000times<br />QUALITY ASSURANCE<br />
Questions?<br />twitter @nacinweb andrewnacin.com<br />email andrewnacin@gmail.com<br />
Upcoming SlideShare
Loading in...5
×

WordPress 3.0 at DC PHP

2,107

Published on

My August 2010 talk at the DC PHP meetup, hosted by Fathom Creative.

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
2,107
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

WordPress 3.0 at DC PHP

  1. 1. WordPress 3.0<br />Andrew Nacin<br />WordPress Core Developer<br />twitter @nacinweb andrewnacin.com<br />email andrewnacin@gmail.com<br />
  2. 2. Make sure WP_CACHE is true. Props nacin.<br />
  3. 3. PHP 5.22011 Q2WordPress 3.2<br />
  4. 4. In nine weeks,WordPress 3.0was downloaded12,654,147 times<br />http://wordpress.org/download/counter/<br />
  5. 5. WordPresspowers8.5 percent of the web<br />Acquia<br />
  6. 6. WordPressis a CMS<br />
  7. 7. Custompost types<br />Customtaxonomies<br />Theme development<br />The mergeof WPMU<br />Why WordPress is a CMS<br />3.0<br />
  8. 8. Custompost types<br />Customtaxonomies<br />Theme development<br />The mergeof WPMU<br />Why WordPress is a CMS<br />
  9. 9. blog<br />site<br />
  10. 10. a post type isacontent type<br />
  11. 11. What can post types be used for?<br />Everything.<br />
  12. 12. Core post types<br />Posts<br />Pages<br />Attachments<br />Revisions<br />Menu Items<br />
  13. 13. They are your content and storage.<br />Blog<br />Articles<br />News Releases<br />Portfolio<br />Products<br />Newsletter<br />Events<br />Tweets<br />Employees<br />My Reading List<br />Documentation<br />Forums<br />Menu Items<br />Uploads<br />Logging<br />Revisions<br />
  14. 14. Why?<br />Some use cases are obvious.<br />Articles, Newsletters, Portfolio, Events<br />Some are not.<br />Logging, Menu items <br />
  15. 15. Leverage what WordPressdoes best<br />Performance<br />No direct queries<br />Utilize caching<br />Extremely light<br />Scalability<br />Ease<br />Full API<br />Full admin UI<br />Use existing features<br />Why reinvent the wheel?<br />
  16. 16. Leverage existing features<br />What can posts have?<br />Title, content, excerpt<br />Author<br />Categories, tags<br />Revisions<br />Comments, Pingbacks<br />Thumbnails<br />Attachments<br />Custom fields (meta)<br />What can you leverage?<br />Templating<br />URL Rewriting<br />WP_Query<br />Capabilities<br />Admin UI, meta boxes<br />Feeds<br />
  17. 17. Let’s put it together<br />add_action( 'init', 'my_employees_init' );<br />function my_employees_init() {<br />register_post_type( 'my_employee', array(<br />'labels' => array(<br />'name' => 'Employees',<br />'singular_name' => 'Employee' ),<br />'public' => true,<br />'show_ui' => true,<br />'rewrite' => array( 'slug' => 'team' ),<br />'query_var' => 'team',<br />'hierarchical' => false,<br />'supports' => array( 'title', 'thumbnail', 'editor', 'excerpt' ),<br /> ) );<br />}<br />
  18. 18. What’s it look like?<br />
  19. 19. Editing me<br />
  20. 20. Let’s create a quick template<br />query_posts( array('post_type' => 'my_employee') );<br />if ( have_posts() ) :<br />while ( have_posts() ) :the_post();<br />echo '<h2><a href="' . get_permalink() . '">' .<br />get_the_title() . '</a></h2>';<br />the_post_thumbnail();<br />the_content();<br />echo '<p>Read posts by ';<br />the_author_posts_link();<br />echo '</p>';<br />endwhile; endif;<br />
  21. 21. Done.<br />/team/<br />/team/andrew-nacin/<br />/blog/author/andrew-nacin/<br />(excuse my CSS)<br />
  22. 22. Custom taxonomiesdescribe your content.<br />
  23. 23. Core taxonomies<br />Post Tags<br />Categories<br />Link Categories<br />Menus<br />
  24. 24. They describe your content.<br />The difference between tags and categories is hierarchy.<br />Topics<br />People<br />Cities<br />Cities<br />Content: Travel blog<br />Cuisine<br />Content: Restaurants<br />Songs<br />Content: Concerts<br />Actors, Directors, Producers<br />Content: Movies<br />
  25. 25. Custom taxonomies are not new<br />Database schema — WP 2.3, Sept. 2007<br />Custom taxonomies — WP 2.5, March 2008<br />Partial UI — WP 2.8, June 2009<br />In WP 3.0 — full custom UI implementation<br />So basically, they’re now on steroids.<br />
  26. 26. Specialties taxonomy<br />register_taxonomy( 'my_specialties', 'nacin_employee', array(<br />'labels' => array(<br />'name' => 'Specialties', 'singular_name' => 'Specialty' ),<br />'public' => true,<br />'show_ui' => true,<br />'query_var' => false,<br />'rewrite' => false,<br />'hierarchical' => false,<br />) );<br />
  27. 27. Edit screen<br />
  28. 28. 'hierarchical' => 'false'<br />
  29. 29. 'hierarchical' => 'true'<br />
  30. 30. WordPress 3.0 makestheme development and customizations easier.<br />
  31. 31. Admin UI screenshot<br />
  32. 32.
  33. 33. How?<br />In our themefunctions.php:<br />function my_theme_setup() {<br />add_custom_background();<br />}<br />add_action( 'after_setup_theme', 'my_theme_setup' );<br />1<br />2<br />3<br />4<br />
  34. 34.
  35. 35. function my_theme_setup() {<br />add_custom_background();<br />define( 'NO_HEADER_TEXT', true );<br />define( 'HEADER_IMAGE_WIDTH', 940 );<br />define( 'HEADER_IMAGE_HEIGHT', 198 );<br />define( 'HEADER_IMAGE', '%s/images/default.jpg' );<br />add_custom_header( 'my_theme_header_style', 'my_theme_admin_header_style' );<br />register_default_header( array(<br /> 'default' => array(<br /> 'url' => '%s/images/default.jpg',<br /> 'thumbnail_url' => '%s/images/default-thumb.jpg',<br />'description' => 'Default Header' ),<br /> ) );<br />}<br />add_action( 'after_setup_theme', 'my_theme_setup' );<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />
  36. 36. Custom Header, cont.<br />function my_theme_admin_header_style() {<br />echo '#headimg { height: ' . HEADER_IMAGE_HEIGHT . 'px; width: ' . HEADER_IMAGE_WIDTH . 'px; }';<br />}<br />function my_theme_header_style() {<br />echo '#header { background-image: url(' . header_image() . '); }';<br />}<br />1<br />2<br />3<br />4<br />5<br />6 <br />
  37. 37. Menus<br />Screenshot of menu admin<br />
  38. 38. In our themefunctions.php:<br />function my_theme_setup() {<br />add_custom_background();<br />add_custom_header( 'my_theme_header_style', 'my_theme_admin_header_style' );<br /> // ...<br />register_nav_menu('header', 'Primary Navigation');<br />}<br />add_action( 'after_setup_theme', 'my_theme_setup' );<br />In our theme header.php:<br />wp_nav_menu( array( 'theme_location' => 'header' ) );<br />1<br />2<br />3<br />4<br />5<br />6<br />7<br />
  39. 39. Menus<br />Screenshot of menus in Twenty Ten<br />
  40. 40. Evolving Theme Development<br />get_template_part()<br />It’s basicallyinclude()on steroids.<br />Example:<br />get_template_part('loop', 'archive');<br />Process:<br />Check for loop-archive.php. Check the child theme first, if applicable.<br />Otherwise, check for loop.php.<br />Less Redundancy FTW.<br />
  41. 41. get_template_part('header', 'home');<br />Is like calling:<br />get_header( 'home' );<br />Same deal: header-home.php,then header.php.<br />
  42. 42. What’s with thetheme improvements?In 3.0, we weretheme developers.<br />
  43. 43. Kubrick!<br />
  44. 44. Twenty Ten<br />
  45. 45. Power one site or 10 million.<br />
  46. 46. WordPress Multisite<br />The WPMU fork was merged<br />Massive merge sprint, followed by cleanup<br />Terminology/concept nightmare<br />TODO: Network admin UI improvements<br />TODO: Easier to manage, use, and install (in that order<br />
  47. 47. Oh no, please don’t.<br />define( 'WP_ALLOW_MULTISITE', true ); <br />
  48. 48. Only if you insist.<br />
  49. 49.
  50. 50. A new Network Admin<br />New MU screen<br />
  51. 51. Other cool features<br />Pick a username/password during install<br />comment_form() and wp_login_form()<br />Stronger authentication security by default<br />Bulk update plugins and themes<br />“Search Engines Blocked”<br />Rewritten initialization code<br />
  52. 52. Follow along<br />#wordpress-dev on freenode.net<br />http://wpdevel.wordpress.com<br />http://core.trac.wordpress.org<br />wp-svn– mailing list for commits<br />wp-hackers – plugin and core developers<br />wp-testers<br />
  53. 53. What might be next<br />Column sorting and a more AJAX feel<br />More features for custom post types and custom taxonomies<br />Support for custom comment types<br />Better support for custom post statuses<br />Media/upload overhaul<br />Incremental admin, DRY, UX changes<br />Incremental improvements to multisite<br />Links as a post type<br />Roles/capabilities overhaul<br />
  54. 54. Our philosophies.<br />codex.wordpress.org/Release_Philosophy<br />
  55. 55. Decisions, not options.<br />
  56. 56. Preferences have a cost.<br />Too many means you can't find any of them.<br />They damage QA and testing.<br />They make good UI difficult.<br />They confuse users.<br />Do something specific and do it well.<br />Defaults that work will lead the UI in the right direction.<br />
  57. 57. The quality of an interface design is inversely proportional to the number of designers.<br />
  58. 58. If you're too lazy to do the homework and think through the big-picture rationale, I'm too lazy to add the feature.<br />
  59. 59. In the presence of good rationale, maintainers should be willing to change their mind often.<br />
  60. 60. Let’s talk security.<br />
  61. 61. QualysBlindElephant<br />BlindElephantis a web application fingerprinter.<br />Drupal, Joomla!, Liferay, Mediawiki, Moodle, MovableType, osCommerce, phpBB, phpMyAdmin, phpNuke, SPIP, WordPress<br />
  62. 62. 96 percent<br />JOOMLA 1.5.20<br />Versions < 1.0.15 and < 1.5.17 are critically insecure. Version 1.5.17 was released 3 months ago.Percentage of installs running a critically insecure version?<br />
  63. 63. 69 percent (and up)<br />DRUPAL 6.19<br />Versions < 5.22 and < 6.16 are critically insecure. Version 6.16 was released in March. Versions 6.18 and 5.23 were critical security fixes released last week.Percentage of installs running a critically insecure version?<br />
  64. 64. 4 percent<br />WORDPRESS 3.0.1<br />Versions < 2.5.1 are critically insecure. (Released in April 2008.)Versions < 2.8.3 are insecure. (August 2009.)Percentage of installs running a critically insecure version?<br />
  65. 65. Shared hosts suck.<br />
  66. 66. security@wordpress.org<br />
  67. 67. pre-release candidates for 3.0 were downloaded 75,000times<br />QUALITY ASSURANCE<br />
  68. 68. Questions?<br />twitter @nacinweb andrewnacin.com<br />email andrewnacin@gmail.com<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×