contributing to wordpress core - peter wilson

120
Dr. Mirko Junge / Wikimedia Commons (CC)

Upload: wordcamp-sydney

Post on 12-Apr-2017

173 views

Category:

Internet


1 download

TRANSCRIPT

Page 1: Contributing to WordPress Core - Peter Wilson

Dr. Mirko Junge / Wikimedia Commons (CC)

Page 2: Contributing to WordPress Core - Peter Wilson

Public domain

Page 3: Contributing to WordPress Core - Peter Wilson

Brooklyn Museum / Wikimedia Commons

Page 4: Contributing to WordPress Core - Peter Wilson

Brooklyn Museum / Wikimedia Commons

Page 5: Contributing to WordPress Core - Peter Wilson

Christophe Finot / Wikimedia Commons (CC)

Page 6: Contributing to WordPress Core - Peter Wilson

Contributing to WordPress CorePeter Wilson • peterwilson.cc • @pwcc

Page 7: Contributing to WordPress Core - Peter Wilson

Contributing to WordPressPeter Wilson • peterwilson.cc • @pwcc

Page 8: Contributing to WordPress Core - Peter Wilson

Contributing to WordPress CorePeter Wilson • peterwilson.cc • @pwcc

Page 9: Contributing to WordPress Core - Peter Wilson
Page 10: Contributing to WordPress Core - Peter Wilson

} else {

$classes[] = 'page-template-default';

Index:/trunk/wp-includes/post-template.php

===================================================================

---/trunk/wp-includes/post-template.php(revision18411)

+++/trunk/wp-includes/post-template.php(revision18412)

@@-490,4+490,6@@

$classes[]='page-template';

$classes[]='page-template-'.sanitize_html_class(str_replace('.','-',get_post_meta($page_id,'_wp_page_template',true)),'');

+}else{

+$classes[]='page-template-default';

}

}elseif(is_search()){

Page 11: Contributing to WordPress Core - Peter Wilson

Sites using WordPressJan 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

Page 12: Contributing to WordPress Core - Peter Wilson
Page 13: Contributing to WordPress Core - Peter Wilson
Page 14: Contributing to WordPress Core - Peter Wilson

wordpress.org/about/philosophy/

Page 15: Contributing to WordPress Core - Peter Wilson

WordPress Core Traccore.trac.wordpress.org

Page 16: Contributing to WordPress Core - Peter Wilson

core.trac.wordpress.org

Page 17: Contributing to WordPress Core - Peter Wilson

core.trac.wordpress.org/browser

Page 18: Contributing to WordPress Core - Peter Wilson

make.wordpress.org/core/reports/

Page 19: Contributing to WordPress Core - Peter Wilson
Page 20: Contributing to WordPress Core - Peter Wilson

core.trac.wordpress.org/my-comments

Page 21: Contributing to WordPress Core - Peter Wilson

core.trac.wordpress.org/tickets/major

Page 22: Contributing to WordPress Core - Peter Wilson

Boring

Page 23: Contributing to WordPress Core - Peter Wilson

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

Page 24: Contributing to WordPress Core - Peter Wilson

Checkout WordPress CoreA version control love story.

Page 25: Contributing to WordPress Core - Peter Wilson

Checkout WordPress via SVN

wordpress-develop

https://develop.svn.wordpress.org/trunk/ ↩svn checkout ↩

Page 26: Contributing to WordPress Core - Peter Wilson

Checkout WordPress CoreA version control love story.

Page 27: Contributing to WordPress Core - Peter Wilson

Clone WordPress via Git

wordpress-develop

git://develop.git.wordpress.org ↩git clone ↩

Page 28: Contributing to WordPress Core - Peter Wilson

Contribute with SVN or Git

Page 29: Contributing to WordPress Core - Peter Wilson

Public domain

Page 30: Contributing to WordPress Core - Peter Wilson

Public domain

Page 31: Contributing to WordPress Core - Peter Wilson
Page 32: Contributing to WordPress Core - Peter Wilson
Page 33: Contributing to WordPress Core - Peter Wilson
Page 34: Contributing to WordPress Core - Peter Wilson
Page 35: Contributing to WordPress Core - Peter Wilson
Page 36: Contributing to WordPress Core - Peter Wilson
Page 37: Contributing to WordPress Core - Peter Wilson
Page 38: Contributing to WordPress Core - Peter Wilson
Page 39: Contributing to WordPress Core - Peter Wilson

Contributing within five minutes

Page 40: Contributing to WordPress Core - Peter Wilson

localhost/phpmyadmin

Page 41: Contributing to WordPress Core - Peter Wilson

localhost/phpmyadmin

Page 42: Contributing to WordPress Core - Peter Wilson

localhost/phpmyadmin

Page 43: Contributing to WordPress Core - Peter Wilson

localhost/phpmyadmin

Page 44: Contributing to WordPress Core - Peter Wilson

localhost/phpmyadmin

Page 45: Contributing to WordPress Core - Peter Wilson

localhost/phpmyadmin

Page 46: Contributing to WordPress Core - Peter Wilson

localhost

Page 47: Contributing to WordPress Core - Peter Wilson
Page 48: Contributing to WordPress Core - Peter Wilson

DB username: root

DB password: root

Page 49: Contributing to WordPress Core - Peter Wilson
Page 50: Contributing to WordPress Core - Peter Wilson
Page 51: Contributing to WordPress Core - Peter Wilson
Page 52: Contributing to WordPress Core - Peter Wilson
Page 53: Contributing to WordPress Core - Peter Wilson
Page 54: Contributing to WordPress Core - Peter Wilson
Page 55: Contributing to WordPress Core - Peter Wilson
Page 56: Contributing to WordPress Core - Peter Wilson
Page 57: Contributing to WordPress Core - Peter Wilson
Page 58: Contributing to WordPress Core - Peter Wilson
Page 59: Contributing to WordPress Core - Peter Wilson
Page 60: Contributing to WordPress Core - Peter Wilson

core.trac.wordpress.org/tickets/good-first-bugs

Page 61: Contributing to WordPress Core - Peter Wilson
Page 62: Contributing to WordPress Core - Peter Wilson
Page 63: Contributing to WordPress Core - Peter Wilson
Page 64: Contributing to WordPress Core - Peter Wilson
Page 65: Contributing to WordPress Core - Peter Wilson

Creating a patch

Page 66: Contributing to WordPress Core - Peter Wilson

~$

Page 67: Contributing to WordPress Core - Peter Wilson

~$git pull

Page 68: Contributing to WordPress Core - Peter Wilson

~$git pullUpdating 470a9fa..e7a6afcFast-forwardsrc/wp-includes/js/swfupload/swfupload.js|2 +-1 file changed, 1 insertion(+), 1 deletion(-)

~$

Page 69: Contributing to WordPress Core - Peter Wilson
Page 70: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Egg<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=="WordCampSydney")

$classes[]="September,2016";

Page 71: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Egg<bodyclass="singlesingle-postpostid-1316single-format-

standardSeptember2016logged-inadmin-barno-customize-

support">

Page 72: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Egg<bodyclass="singlesingle-postpostid-1316single-format-

standardSeptember2016logged-inadmin-barno-customize-

support">

<bodyclass="singlesingle-postpostid-1316single-format-

standardSeptember,2016logged-inadmin-barno-customize-

support">

Page 73: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Egg<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=="WordCampSydney")

$classes[]=sanitize_html_class("September,2016");

Page 74: Contributing to WordPress Core - Peter Wilson

<bodyclass="singlesingle-postpostid-1316single-format-

standardSeptember2016logged-inadmin-barno-customize-

support">

WordCamp Easter Egg

Page 75: Contributing to WordPress Core - Peter Wilson

<bodyclass="singlesingle-postpostid-1316single-format-

standardSeptember2016logged-inadmin-barno-customize-

support">

<bodyclass="singlesingle-postpostid-1316single-format-

standardSeptember2016logged-inadmin-barno-customize-

support">

WordCamp Easter Egg

Page 76: Contributing to WordPress Core - Peter Wilson

Public domain

Page 77: Contributing to WordPress Core - Peter Wilson

Malcolm Best (CC)

Page 78: Contributing to WordPress Core - Peter Wilson
Page 79: Contributing to WordPress Core - Peter Wilson
Page 80: Contributing to WordPress Core - Peter Wilson
Page 81: Contributing to WordPress Core - Peter Wilson
Page 82: Contributing to WordPress Core - Peter Wilson

This is what happens in a world without standards.

Page 83: Contributing to WordPress Core - Peter Wilson

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

Page 84: Contributing to WordPress Core - Peter Wilson

WordPress Coding Standards<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=="WordCampSydney")

$classes[]=sanitize_html_class("September,2016");

Page 85: Contributing to WordPress Core - Peter Wilson
Page 86: Contributing to WordPress Core - Peter Wilson

make.wordpress.org/core/coding-standards/

Page 87: Contributing to WordPress Core - Peter Wilson

WordPress Coding Standards<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=="WordCampSydney")

$classes[]=sanitize_html_class("September,2016");

Page 88: Contributing to WordPress Core - Peter Wilson

Spaces<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=="WordCampSydney")

$classes[]=sanitize_html_class("September,2016");

Page 89: Contributing to WordPress Core - Peter Wilson

No inline control structures<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=="WordCampSydney"){

$classes[]=sanitize_html_class("September,2016");

}

Page 90: Contributing to WordPress Core - Peter Wilson

No inline control structures<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=="WordCampSydney"){

$classes[]=sanitize_html_class("September,2016");

$classes[]=sanitize_html_class("all-welcome");

}

Page 91: Contributing to WordPress Core - Peter Wilson

No inline control structures<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=="WordCampSydney"){

$classes[]=sanitize_html_class("September,2016");

}

Page 92: Contributing to WordPress Core - Peter Wilson

Single quotes preferred<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if($title=='WordCampSydney'){

$classes[]=sanitize_html_class('September,2016');

}

Page 93: Contributing to WordPress Core - Peter Wilson

Yoda Conditions<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if('WordCampSydney'==$title){

$classes[]=sanitize_html_class('September,2016');

}

Page 94: Contributing to WordPress Core - Peter Wilson

=== != ==<?php

//Insideget_body_class()

$title=get_the_title($post_id);

if('WordCampSydney'===$title){

$classes[]=sanitize_html_class('September,2016');

}

Page 95: Contributing to WordPress Core - Peter Wilson

Uploading a patch

Page 96: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Egg }

}

$title=get_the_title($post_id);

if('WordCampSydney'===$title){

$classes[]=sanitize_html_class('September,2016');

}

if(is_attachment()){

$mime_type=get_post_mime_type($post_id);

$mime_prefix=array('application/','image/','text/',

Page 97: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Egg }

}

$title=get_the_title($post_id);

if('WordCampSydney'===$title){

$classes[]=sanitize_html_class('September,2016');

}

if(is_attachment()){

$mime_type=get_post_mime_type($post_id);

$mime_prefix=array('application/','image/','text/',

src/wp-includes/post-template.php

Page 98: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Egg

git diff

Page 99: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Eggdiff--gita/src/wp-includes/post-template.phpb/src/wp-includes/post-template.phpindex7994f89..f1a0cad100644---a/src/wp-includes/post-template.php+++b/src/wp-includes/post-template.php@@-614,6+614,11@@functionget_body_class($class=''){}}

+$title=get_the_title($post_id);+if('WordCampSydney'===$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/'...

Page 100: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Eggdiff--gita/src/wp-includes/post-template.phpb/src/wp-includes/post-template.phpindex7994f89..f1a0cad100644---a/src/wp-includes/post-template.php+++b/src/wp-includes/post-template.php@@-614,6+614,11@@functionget_body_class($class=''){}}

+$title=get_the_title($post_id);+if('WordCampSydney'===$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/'...

Page 101: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Eggdiff--gita/src/wp-includes/post-template.phpb/src/wp-includes/post-template.phpindex7994f89..f1a0cad100644---a/src/wp-includes/post-template.php+++b/src/wp-includes/post-template.php@@-614,6+614,11@@functionget_body_class($class=''){}}

+$title=get_the_title($post_id);+if('WordCampSydney'===$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/'...

Page 102: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Eggdiff--gita/src/wp-includes/post-template.phpb/src/wp-includes/post-template.phpindex7994f89..f1a0cad100644---a/src/wp-includes/post-template.php+++b/src/wp-includes/post-template.php@@-614,6+614,11@@functionget_body_class($class=''){}}

+$title=get_the_title($post_id);+if('WordCampSydney'===$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/'...

Page 103: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Eggdiff--gita/src/wp-includes/post-template.phpb/src/wp-includes/post-template.phpindex7994f89..f1a0cad100644---a/src/wp-includes/post-template.php+++b/src/wp-includes/post-template.php@@-614,6+614,11@@functionget_body_class($class=''){}}

+$title=get_the_title($post_id);+if('WordCampSydney'===$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/'...

Page 104: Contributing to WordPress Core - Peter Wilson

WordCamp Easter Eggdiff--gita/src/wp-includes/post-template.phpb/src/wp-includes/post-template.phpindex7994f89..f1a0cad100644---a/src/wp-includes/post-template.php+++b/src/wp-includes/post-template.php@@-614,6+614,11@@functionget_body_class($class=''){}}

+$title=get_the_title($post_id);+if('WordCampSydney'===$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/'...

Page 105: Contributing to WordPress Core - Peter Wilson

Generating a patch

> ~/Downloads/37941.diffgit diff

Page 106: Contributing to WordPress Core - Peter Wilson

gitdiff

Generating a patch

> ~/Downloads/37941.diff

Page 107: Contributing to WordPress Core - Peter Wilson
Page 108: Contributing to WordPress Core - Peter Wilson
Page 109: Contributing to WordPress Core - Peter Wilson

You retain the copyright. You license your code to WordPress

Page 110: Contributing to WordPress Core - Peter Wilson
Page 111: Contributing to WordPress Core - Peter Wilson
Page 112: Contributing to WordPress Core - Peter Wilson
Page 113: Contributing to WordPress Core - Peter Wilson

Let the code reviews begin

Page 114: Contributing to WordPress Core - Peter Wilson
Page 115: Contributing to WordPress Core - Peter Wilson

flic.kr/p/y35dEE (CC)

Page 116: Contributing to WordPress Core - Peter Wilson

Hack WordPress core,contribute code back.

Page 117: Contributing to WordPress Core - Peter Wilson

Hack WordPress docs,contribute docs back.

Page 118: Contributing to WordPress Core - Peter Wilson

Translate WordPress,help spread the word.

Page 119: Contributing to WordPress Core - Peter Wilson

Contribute however you can,however you feel comfortable.

Page 120: Contributing to WordPress Core - Peter Wilson

Thank youPeter Wilson • peterwilson.cc • @pwcc