Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WordCamp Sydney: Contributing to WordPress Core

1dd9fded718f9b344d48f37f9bfcb159?s=47 Peter Wilson
September 24, 2016

WordCamp Sydney: Contributing to WordPress Core

Almost everyone will have heard the phrase “don’t hack WordPress core” before, what’s less known is that it’s only the start of the saying. Don’t hack WordPress core, without contributing the hacks back.

Contributing to WordPress core is like riding a bike, it takes a little effort to get started but once you learn it’s a skill you’ll never forget.

You will be given a jump start on contributing, from how to use the bug tracker all the way to contributing a patch and getting your first props.

1dd9fded718f9b344d48f37f9bfcb159?s=128

Peter Wilson

September 24, 2016
Tweet

Transcript

  1. Dr. Mirko Junge / Wikimedia Commons (CC)

  2. Public domain

  3. Brooklyn Museum / Wikimedia Commons

  4. Brooklyn Museum / Wikimedia Commons

  5. Christophe Finot / Wikimedia Commons (CC)

  6. Contributing to WordPress Core Peter Wilson • peterwilson.cc • @pwcc

  7. Contributing to WordPress Peter Wilson • peterwilson.cc • @pwcc

  8. Contributing to WordPress Core Peter Wilson • peterwilson.cc • @pwcc

  9. None
  10. } else { $classes[] = 'page-template-default'; Index: /trunk/wp-includes/post-template.php ================================================================= ---

    /trunk/wp-includes/post-template.php (revision 18411) +++ /trunk/wp-includes/post-template.php (revision 18412) @@ -490,4 +490,6 @@ $classes[] = 'page-template'; $classes[] = 'page-template-' . sanitize_html_class( str_repla + } else { + $classes[] = 'page-template-default'; } } elseif ( is_search() ) {
  11. Sites using WordPress Jan 2011 onward (%) 5.0% 10.0% 15.0%

    20.0% 25.0% 30.0% 1 Jan 2011 1 Jan 2012 1 Jan 2013 1 Jan 2014 1 Jan 2015 1 Jan 2016 30 Jul 2016 w3techs.com, July 2016
  12. None
  13. None
  14. wordpress.org/about/philosophy/

  15. WordPress Core Trac core.trac.wordpress.org

  16. core.trac.wordpress.org

  17. core.trac.wordpress.org/browser

  18. make.wordpress.org/core/reports/

  19. None
  20. core.trac.wordpress.org/my-comments

  21. core.trac.wordpress.org/tickets/major

  22. Boring

  23. Sites using WordPress 5.0% 10.0% 15.0% 20.0% 25.0% 30.0% 1

    Jan 2011 1 Jan 2012 1 Jan 2013 1 Jan 2014 1 Jan 2015 1 Jan 2016 30 Jul 2016 Boring
  24. Checkout WordPress Core A version control love story.

  25. Checkout WordPress via SVN wordpress-develop https://develop.svn.wordpress.org/trunk/ ↩ svn checkout ↩

  26. Checkout WordPress Core A version control love story.

  27. Clone WordPress via Git wordpress-develop git://develop.git.wordpress.org ↩ git clone ↩

  28. Contribute with SVN or Git

  29. Public domain

  30. Public domain

  31. None
  32. None
  33. None
  34. None
  35. None
  36. None
  37. None
  38. None
  39. Contributing within five minutes

  40. localhost/phpmyadmin

  41. localhost/phpmyadmin

  42. localhost/phpmyadmin

  43. localhost/phpmyadmin

  44. localhost/phpmyadmin

  45. localhost/phpmyadmin

  46. localhost

  47. None
  48. DB username: root DB password: root

  49. None
  50. None
  51. None
  52. None
  53. None
  54. None
  55. None
  56. None
  57. None
  58. None
  59. None
  60. core.trac.wordpress.org/tickets/good-first-bugs

  61. None
  62. None
  63. None
  64. None
  65. Creating a patch

  66. ~$

  67. ~$ git pull

  68. ~$ git pull Updating 470a9fa..e7a6afc Fast-forward src/wp-includes/js/swfupload/swfupload.js|2 +- 1 file

    changed, 1 insertion(+), 1 deletion(-) ~$
  69. None
  70. WordCamp Easter Egg <?php // Inside get_body_class() $title = get_the_title($post_id);

    if ($title == "WordCamp Sydney") $classes[] = "September, 2016";
  71. WordCamp Easter Egg <body class="single single-post postid-1316 single-format- standard September

    2016 logged-in admin-bar no-customize- support">
  72. WordCamp Easter Egg <body class="single single-post postid-1316 single-format- standard September

    2016 logged-in admin-bar no-customize- support"> <body class="single single-post postid-1316 single-format- standard September, 2016 logged-in admin-bar no-customize- support">
  73. WordCamp Easter Egg <?php // Inside get_body_class() $title = get_the_title($post_id);

    if ($title == "WordCamp Sydney") $classes[] = sanitize_html_class("September, 2016");
  74. <body class="single single-post postid-1316 single-format- standard September2016 logged-in admin-bar no-customize-

    support"> WordCamp Easter Egg
  75. <body class="single single-post postid-1316 single-format- standard September2016 logged-in admin-bar no-customize-

    support"> <body class="single single-post postid-1316 single-format- standard September2016 logged-in admin-bar no-customize- support"> WordCamp Easter Egg
  76. Public domain

  77. Malcolm Best (CC)

  78. None
  79. None
  80. None
  81. None
  82. This is what happens in a world without standards.

  83. Saroar Zubair (CC), flic.kr/p/a1ePPd

  84. WordPress Coding Standards <?php // Inside get_body_class() $title = get_the_title($post_id);

    if ($title == "WordCamp Sydney") $classes[] = sanitize_html_class("September, 2016");
  85. None
  86. make.wordpress.org/core/coding-standards/

  87. WordPress Coding Standards <?php // Inside get_body_class() $title = get_the_title($post_id);

    if ($title == "WordCamp Sydney") $classes[] = sanitize_html_class("September, 2016");
  88. Spaces <?php // Inside get_body_class() $title = get_the_title( $post_id );

    if ( $title == "WordCamp Sydney" ) $classes[] = sanitize_html_class( "September, 2016" );
  89. No inline control structures <?php // Inside get_body_class() $title =

    get_the_title( $post_id ); if ( $title == "WordCamp Sydney" ) { $classes[] = sanitize_html_class( "September, 2016" ); }
  90. No inline control structures <?php // Inside get_body_class() $title =

    get_the_title( $post_id ); if ( $title == "WordCamp Sydney" ) { $classes[] = sanitize_html_class( "September, 2016" ); $classes[] = sanitize_html_class( "all-welcome" ); }
  91. No inline control structures <?php // Inside get_body_class() $title =

    get_the_title( $post_id ); if ( $title == "WordCamp Sydney" ) { $classes[] = sanitize_html_class( "September, 2016" ); }
  92. Single quotes preferred <?php // Inside get_body_class() $title = get_the_title(

    $post_id ); if ( $title == 'WordCamp Sydney' ) { $classes[] = sanitize_html_class( 'September, 2016' ); }
  93. Yoda Conditions <?php // Inside get_body_class() $title = get_the_title( $post_id

    ); if ( 'WordCamp Sydney' == $title ) { $classes[] = sanitize_html_class( 'September, 2016' ); }
  94. === != == <?php // Inside get_body_class() $title = get_the_title(

    $post_id ); if ( 'WordCamp Sydney' === $title ) { $classes[] = sanitize_html_class( 'September, 2016' ); }
  95. Uploading a patch

  96. WordCamp Easter Egg } } $title = get_the_title( $post_id );

    if ( 'WordCamp Sydney' === $title ) { $classes[] = sanitize_html_class( 'September, 2016' ); } if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id);
  97. WordCamp Easter Egg } } $title = get_the_title( $post_id );

    if ( 'WordCamp Sydney' === $title ) { $classes[] = sanitize_html_class( 'September, 2016' ); } if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id); src/wp-includes/post-template.php
  98. WordCamp Easter Egg git diff

  99. WordCamp Easter Egg diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 7994f89..f1a0cad 100644

    --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -614,6 +614,11 @@ function get_body_class( $class = '' ) { } } + $title = get_the_title( $post_id ); + if ( 'WordCamp Sydney' === $title ) { + $classes[] = sanitize_html_class( 'September, 2016' ); + } + if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/'...
  100. WordCamp Easter Egg diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 7994f89..f1a0cad 100644

    --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -614,6 +614,11 @@ function get_body_class( $class = '' ) { } } + $title = get_the_title( $post_id ); + if ( 'WordCamp Sydney' === $title ) { + $classes[] = sanitize_html_class( 'September, 2016' ); + } + if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/'...
  101. WordCamp Easter Egg diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 7994f89..f1a0cad 100644

    --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -614,6 +614,11 @@ function get_body_class( $class = '' ) { } } + $title = get_the_title( $post_id ); + if ( 'WordCamp Sydney' === $title ) { + $classes[] = sanitize_html_class( 'September, 2016' ); + } + if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/'...
  102. WordCamp Easter Egg diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 7994f89..f1a0cad 100644

    --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -614,6 +614,11 @@ function get_body_class( $class = '' ) { } } + $title = get_the_title( $post_id ); + if ( 'WordCamp Sydney' === $title ) { + $classes[] = sanitize_html_class( 'September, 2016' ); + } + if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/'...
  103. WordCamp Easter Egg diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 7994f89..f1a0cad 100644

    --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -614,6 +614,11 @@ function get_body_class( $class = '' ) { } } + $title = get_the_title( $post_id ); + if ( 'WordCamp Sydney' === $title ) { + $classes[] = sanitize_html_class( 'September, 2016' ); + } + if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/'...
  104. WordCamp Easter Egg diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 7994f89..f1a0cad 100644

    --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -614,6 +614,11 @@ function get_body_class( $class = '' ) { } } + $title = get_the_title( $post_id ); + if ( 'WordCamp Sydney' === $title ) { + $classes[] = sanitize_html_class( 'September, 2016' ); + } + if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/'...
  105. Generating a patch > ~/Downloads/37941.diff git diff

  106. git diff Generating a patch > ~/Downloads/37941.diff

  107. None
  108. None
  109. You retain the copyright. You license your code to WordPress

  110. None
  111. None
  112. None
  113. Let the code reviews begin

  114. None
  115. flic.kr/p/y35dEE (CC)

  116. Hack WordPress core, contribute code back.

  117. Hack WordPress docs, contribute docs back.

  118. Translate WordPress, help spread the word.

  119. Contribute however you can, however you feel comfortable.

  120. Thank you Peter Wilson • peterwilson.cc • @pwcc