WordPress 3.0 at DC PHP

  • 1,957 views
Uploaded on

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

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

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,957
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
4
Comments
0
Likes
0

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