WordCamp SG: Contributing to WordPress Core

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

WordCamp SG: 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 06, 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. None
  17. core.trac.wordpress.org

  18. core.trac.wordpress.org/browser

  19. make.wordpress.org/core/reports/

  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

  43. None
  44. None
  45. None
  46. None
  47. core.trac.wordpress.org/tickets/good-first-bugs

  48. None
  49. None
  50. Creating a patch

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

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

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

    2016 logged-in admin-bar no-customize- support">
  55. 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">
  56. WordCamp Easter Egg <?php // Inside get_body_class() $title = get_the_title($post_id);

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

    support"> WordCamp Easter Egg
  58. <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
  59. Public domain

  60. Malcolm Best (CC)

  61. None
  62. None
  63. None
  64. This is what happens in a world without standards.

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

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

    if ($title == "WordCamp Singapore") $classes[] = sanitize_html_class("September, 2016");
  67. WordPress Coding Standards <?php // Inside get_body_class() $title = get_the_title($post_id);

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

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

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

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

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

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

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

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

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

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

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

  79. 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 Singapore' === $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/'...
  80. 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 Singapore' === $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/'...
  81. 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 Singapore' === $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/'...
  82. 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 Singapore' === $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/'...
  83. 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 Singapore' === $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/'...
  84. 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 Singapore' === $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/'...
  85. Generating a patch > ~/Downloads/37941.diff git diff

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

  87. None
  88. None
  89. You retain the copyright. You license your code to WordPress

  90. None
  91. None
  92. None
  93. Let the code reviews begin

  94. None
  95. flic.kr/p/y35dEE (CC)

  96. Hack WordPress core, contribute code back.

  97. Hack WordPress docs, contribute docs back.

  98. Translate WordPress, help spread the word.

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

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