PHP For Absolute
Beginners
Matt Wiebe
@mattwiebe
wp.mattwie.be
Design Engineer
Automattic / WordPress.com
Slide 2
Slide 2 text
PHP
Slide 3
Slide 3 text
PHP
Slide 4
Slide 4 text
No content
Slide 5
Slide 5 text
PHP
For people who may or may not know what that is.
Slide 6
Slide 6 text
What is PHP?
Slide 7
Slide 7 text
What is PHP?
★ The thing that makes WordPress work
Slide 8
Slide 8 text
What is PHP?
★ The thing that makes WordPress work
★ The thing you should know a little bit
about if you want to tweak a theme or
plugin.
Slide 9
Slide 9 text
What is PHP?
★ The thing that makes WordPress work
★ The thing you should know a little bit
about if you want to tweak a theme or
plugin.
★ PHP: Hypertext Preprocessor
Slide 10
Slide 10 text
No content
Slide 11
Slide 11 text
What is PHP?
★ The thing that makes WordPress work
★ The thing you should know a little bit
about if you want to tweak a theme or
plugin.
★ PHP: Hypertext Preprocessor
★ The easiest way to get started with
programming.
Slide 12
Slide 12 text
What is PHP?
★ The thing that makes WordPress work
★ The thing you should know a little bit
about if you want to tweak a theme or
plugin.
★ PHP: Hypertext Preprocessor
★ The easiest way to get started with
programming. (except maybe JavaScript)
Slide 13
Slide 13 text
What is PHP?
Slide 14
Slide 14 text
What is PHP?
Slide 15
Slide 15 text
What is PHP?
Slide 16
Slide 16 text
What is PHP?
Slide 17
Slide 17 text
No content
Slide 18
Slide 18 text
Why should I learn PHP?
Slide 19
Slide 19 text
Why should I learn PHP?
★ It’s what makes WordPress sing and dance
Slide 20
Slide 20 text
Why should I learn PHP?
★ It’s what makes WordPress sing and dance
★ It’s easy
Slide 21
Slide 21 text
Why should I learn PHP?
★ It’s what makes WordPress sing and dance
★ It’s easy
★ It’s fun
Slide 22
Slide 22 text
Why should I learn PHP?
★ It’s what makes WordPress sing and dance
★ It’s easy
★ It’s fun
★ It might turn a hobby into a career
Slide 23
Slide 23 text
THE BASICS
Slide 24
Slide 24 text
Variables
Slide 25
Slide 25 text
Variables
$my_string = 'bar';
Slide 26
Slide 26 text
Variables
$my_string = 'bar';
Slide 27
Slide 27 text
Variables
$my_string = 'bar';
// This is a comment. It is ignored.
Slide 28
Slide 28 text
Variables
$my_string = 'bar';
// This is a comment. It is ignored.
$my_number = 3;
Slide 29
Slide 29 text
Variables
$my_string = 'bar';
// This is a comment. It is ignored.
$my_number = 3;
$my_array = array('one', 'two', 'ten');
Slide 30
Slide 30 text
Variables
$my_string = 'bar';
// This is a comment. It is ignored.
$my_number = 3;
$my_array = array('one', 'two', 'ten');
$my_boolean = true;
Slide 31
Slide 31 text
Variables
$my_string = 'bar';
// This is a comment. It is ignored.
$my_number = 3;
$my_array = array('one', 'two', 'ten');
$my_boolean = true;
/* Now you've seen 4 types of data */
Comparisons
$a == $b // Equal
$a != $b // Not equal
$a >= $b // $a greater than or equal to $b
$a <= $b // $a less than or equal to $b
$a > $b // $a greater than $b
$a < $b // $a less than $b
Slide 45
Slide 45 text
Comparisons
$a == $b // Equal
$a != $b // Not equal
$a >= $b // $a greater than or equal to $b
$a <= $b // $a less than or equal to $b
$a > $b // $a greater than $b
$a < $b // $a less than $b
/* There are a lot more but
that’s all we’ll cover now. */
Slide 46
Slide 46 text
Using Comparisons
if ( $a == $b ) {
}
Slide 47
Slide 47 text
Using Comparisons
if ( $a == $b ) {
}
Slide 48
Slide 48 text
Using Comparisons
if ( $a == $b ) {
// do something
}
Slide 49
Slide 49 text
Using Comparisons
if ( $a == $b ) {
// do something
}
else {
}
Slide 50
Slide 50 text
Using Comparisons
if ( $a == $b ) {
// do something
}
else {
// do something else
}
WordPress Functions
★ Read the Codex:
★ codex.wordpress.org
Slide 73
Slide 73 text
WordPress Functions
★ Read the Codex:
★ codex.wordpress.org
★ Learn the template hierarchy
Slide 74
Slide 74 text
WordPress Functions
★ Read the Codex:
★ codex.wordpress.org
★ Learn the template hierarchy
★ codex.wordpress.org/Template_Hierarchy
Slide 75
Slide 75 text
WordPress Functions
★ Read the Codex:
★ codex.wordpress.org
★ Learn the template hierarchy
★ codex.wordpress.org/Template_Hierarchy
★ Make a child theme to hack on
Slide 76
Slide 76 text
WordPress Functions
★ Read the Codex:
★ codex.wordpress.org
★ Learn the template hierarchy
★ codex.wordpress.org/Template_Hierarchy
★ Make a child theme to hack on
★ codex.wordpress.org/Child_Themes
Slide 77
Slide 77 text
WordPress Functions
★ Learn the template tags (functions):
Slide 78
Slide 78 text
WordPress Functions
★ Learn the template tags (functions):
★ codex.wordpress.org/Template_Tags
Slide 79
Slide 79 text
No content
Slide 80
Slide 80 text
?>
Matt Wiebe
@mattwiebe
wp.mattwie.be
Design Engineer
Automattic / WordPress.com