Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Contributing to WordPress Core - Peter Wilson

829 views

Published on

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.

Published in: Internet
  • Login to see the comments

Contributing to WordPress Core - Peter Wilson

  1. 1. Dr. Mirko Junge / Wikimedia Commons (CC)
  2. 2. Public domain
  3. 3. Brooklyn Museum / Wikimedia Commons
  4. 4. Brooklyn Museum / Wikimedia Commons
  5. 5. Christophe Finot / Wikimedia Commons (CC)
  6. 6. Contributing to WordPress Core Peter Wilson • peterwilson.cc • @pwcc
  7. 7. Contributing to WordPress Peter Wilson • peterwilson.cc • @pwcc
  8. 8. Contributing to WordPress Core Peter Wilson • peterwilson.cc • @pwcc
  9. 9. } 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() ) {
  10. 10. 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
  11. 11. wordpress.org/about/philosophy/
  12. 12. WordPress Core Trac core.trac.wordpress.org
  13. 13. core.trac.wordpress.org
  14. 14. core.trac.wordpress.org/browser
  15. 15. make.wordpress.org/core/reports/
  16. 16. core.trac.wordpress.org/my-comments
  17. 17. core.trac.wordpress.org/tickets/major
  18. 18. Boring
  19. 19. 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
  20. 20. Checkout WordPress Core A version control love story.
  21. 21. Checkout WordPress via SVN wordpress-develop https://develop.svn.wordpress.org/trunk/ ↩ svn checkout ↩
  22. 22. Checkout WordPress Core A version control love story.
  23. 23. Clone WordPress via Git wordpress-develop git://develop.git.wordpress.org ↩ git clone ↩
  24. 24. Contribute with SVN or Git
  25. 25. Public domain
  26. 26. Public domain
  27. 27. Contributing within five minutes
  28. 28. localhost/phpmyadmin
  29. 29. localhost/phpmyadmin
  30. 30. localhost/phpmyadmin
  31. 31. localhost/phpmyadmin
  32. 32. localhost/phpmyadmin
  33. 33. localhost/phpmyadmin
  34. 34. localhost
  35. 35. DB username: root DB password: root
  36. 36. core.trac.wordpress.org/tickets/good-first-bugs
  37. 37. Creating a patch
  38. 38. ~$
  39. 39. ~$ git pull
  40. 40. ~$ git pull Updating 470a9fa..e7a6afc Fast-forward src/wp-includes/js/swfupload/swfupload.js|2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ~$
  41. 41. WordCamp Easter Egg <?php // Inside get_body_class() $title = get_the_title($post_id); if ($title == "WordCamp Sydney") $classes[] = "September, 2016";
  42. 42. WordCamp Easter Egg <body class="single single-post postid-1316 single-format- standard September 2016 logged-in admin-bar no-customize- support">
  43. 43. 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">
  44. 44. WordCamp Easter Egg <?php // Inside get_body_class() $title = get_the_title($post_id); if ($title == "WordCamp Sydney") $classes[] = sanitize_html_class("September, 2016");
  45. 45. <body class="single single-post postid-1316 single-format- standard September2016 logged-in admin-bar no-customize- support"> WordCamp Easter Egg
  46. 46. <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
  47. 47. Public domain
  48. 48. Malcolm Best (CC)
  49. 49. This is what happens in a world without standards.
  50. 50. Saroar Zubair (CC), flic.kr/p/a1ePPd
  51. 51. WordPress Coding Standards <?php // Inside get_body_class() $title = get_the_title($post_id); if ($title == "WordCamp Sydney") $classes[] = sanitize_html_class("September, 2016");
  52. 52. make.wordpress.org/core/coding-standards/
  53. 53. WordPress Coding Standards <?php // Inside get_body_class() $title = get_the_title($post_id); if ($title == "WordCamp Sydney") $classes[] = sanitize_html_class("September, 2016");
  54. 54. Spaces <?php // Inside get_body_class() $title = get_the_title( $post_id ); if ( $title == "WordCamp Sydney" ) $classes[] = sanitize_html_class( "September, 2016" );
  55. 55. 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" ); }
  56. 56. 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" ); }
  57. 57. 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" ); }
  58. 58. Single quotes preferred <?php // Inside get_body_class() $title = get_the_title( $post_id ); if ( $title == 'WordCamp Sydney' ) { $classes[] = sanitize_html_class( 'September, 2016' ); }
  59. 59. Yoda Conditions <?php // Inside get_body_class() $title = get_the_title( $post_id ); if ( 'WordCamp Sydney' == $title ) { $classes[] = sanitize_html_class( 'September, 2016' ); }
  60. 60. === != == <?php // Inside get_body_class() $title = get_the_title( $post_id ); if ( 'WordCamp Sydney' === $title ) { $classes[] = sanitize_html_class( 'September, 2016' ); }
  61. 61. Uploading a patch
  62. 62. 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);
  63. 63. 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
  64. 64. WordCamp Easter Egg git diff
  65. 65. 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/'...
  66. 66. 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/'...
  67. 67. 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/'...
  68. 68. 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/'...
  69. 69. 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/'...
  70. 70. 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/'...
  71. 71. Generating a patch > ~/Downloads/37941.diffgit diff
  72. 72. git diff Generating a patch > ~/Downloads/37941.diff
  73. 73. You retain the copyright. You license your code to WordPress
  74. 74. Let the code reviews begin
  75. 75. flic.kr/p/y35dEE (CC)
  76. 76. Hack WordPress core, contribute code back.
  77. 77. Hack WordPress docs, contribute docs back.
  78. 78. Translate WordPress, help spread the word.
  79. 79. Contribute however you can, however you feel comfortable.
  80. 80. Thank you Peter Wilson • peterwilson.cc • @pwcc

×