Slide 1

Slide 1 text

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 */

Slide 32

Slide 32 text

Operations

Slide 33

Slide 33 text

Operations $first_name = 'Matt'; $last_name = 'Wiebe';

Slide 34

Slide 34 text

Operations $first_name = 'Matt'; $last_name = 'Wiebe'; // Concatenation $full_name = $first_name . ' ' . $last_name;

Slide 35

Slide 35 text

Operations $my_age = 33; $my_nephews_age = 3;

Slide 36

Slide 36 text

Operations $my_age = 33; $my_nephews_age = 3; // Simple numeric operations: +-*/ $age_difference = $my_age - $my_nephews_age;

Slide 37

Slide 37 text

Comparisons

Slide 38

Slide 38 text

Comparisons $my_name = 'Matt'; $dans_name = 'Dan'; $my_bosses_name = 'Matt';

Slide 39

Slide 39 text

Comparisons $my_name = 'Matt'; $dans_name = 'Dan'; $my_bosses_name = 'Matt'; $my_name == $dans_name

Slide 40

Slide 40 text

Comparisons $my_name = 'Matt'; $dans_name = 'Dan'; $my_bosses_name = 'Matt'; $my_name == $dans_name;

Slide 41

Slide 41 text

Comparisons $my_name = 'Matt'; $dans_name = 'Dan'; $my_bosses_name = 'Matt'; $my_name == $dans_name; // false;

Slide 42

Slide 42 text

Comparisons $my_name = 'Matt'; $dans_name = 'Dan'; $my_bosses_name = 'Matt'; $my_name == $dans_name; // false; $my_name == $my_bosses_name;

Slide 43

Slide 43 text

Comparisons $my_name = 'Matt'; $dans_name = 'Dan'; $my_bosses_name = 'Matt'; $my_name == $dans_name; // false; $my_name == $my_bosses_name; // true;

Slide 44

Slide 44 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

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 }

Slide 51

Slide 51 text

Functions

Slide 52

Slide 52 text

Functions

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Functions $name = 'Matt Wiebe';

Slide 55

Slide 55 text

Functions $name = 'Matt Wiebe'; $fun = str_replace( 'Matt', 'Jerk', $name );

Slide 56

Slide 56 text

Functions $name = 'Matt Wiebe'; $fun = str_replace( 'Matt', 'Jerk', $name );

Slide 57

Slide 57 text

Functions $name = 'Matt Wiebe'; $fun = str_replace( 'Matt', 'Jerk', $name );

Slide 58

Slide 58 text

Functions $name = 'Matt Wiebe'; $fun = str_replace( 'Matt', 'Jerk', $name );

Slide 59

Slide 59 text

Functions $name = 'Matt Wiebe'; $fun = str_replace( 'Matt', 'Jerk', $name );

Slide 60

Slide 60 text

Functions $name = 'Matt Wiebe'; $fun = str_replace( 'Matt', 'Jerk', $name ); echo $fun; // 'Jerk Wiebe'

Slide 61

Slide 61 text

WordPress Functions

Slide 62

Slide 62 text

WordPress Functions In WordPress, template tags are PHP functions.

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

WordPress Functions Home

Slide 65

Slide 65 text

WordPress Functions Home

Slide 66

Slide 66 text

WordPress Functions Home

Slide 67

Slide 67 text

WordPress Functions Home

Slide 68

Slide 68 text

WordPress Functions Home

Slide 69

Slide 69 text

WordPress Functions Home

Slide 70

Slide 70 text

WordPress Functions Home

Slide 71

Slide 71 text

WordPress Functions ★ Read the Codex:

Slide 72

Slide 72 text

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