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

WordCamp SG: Contributing to WordPress Core

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.

Peter Wilson

September 06, 2016
Tweet

More Decks by Peter Wilson

Other Decks in Technology

Transcript

  1. } 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() ) {
  2. 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
  3. 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
  4. WordCamp Easter Egg <?php // Inside get_body_class() $title = get_the_title($post_id);

    if ($title == "WordCamp Singapore") $classes[] = "September, 2016";
  5. 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">
  6. WordCamp Easter Egg <?php // Inside get_body_class() $title = get_the_title($post_id);

    if ($title == "WordCamp Singapore") $classes[] = sanitize_html_class("September, 2016");
  7. <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
  8. WordPress Coding Standards <?php // Inside get_body_class() $title = get_the_title($post_id);

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

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

    if ( $title == "WordCamp Singapore" ) $classes[] = sanitize_html_class( "September, 2016" );
  11. 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" ); }
  12. 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" ); }
  13. 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" ); }
  14. Single quotes preferred <?php // Inside get_body_class() $title = get_the_title(

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

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

    $post_id ); if ( 'WordCamp Singapore' === $title ) { $classes[] = sanitize_html_class( 'September, 2016' ); }
  17. 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);
  18. 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
  19. 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/'...
  20. 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/'...
  21. 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/'...
  22. 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/'...
  23. 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/'...
  24. 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/'...