Slide 1

Slide 1 text

markwilkinson.me | @wpmark Extensible WordPress Plugins WordPress Cumbria – 14th October 2014 #wpcumbria

Slide 2

Slide 2 text

mark wilkinson?

Slide 3

Slide 3 text

markwilkinson.me | @wpmark father

Slide 4

Slide 4 text

markwilkinson.me | @wpmark teacher

Slide 5

Slide 5 text

markwilkinson.me | @wpmark WordPress developer

Slide 6

Slide 6 text

markwilkinson.me | @wpmark

Slide 7

Slide 7 text

markwilkinson.me | @wpmark this talk will cover what is extensibility? why should you be making extensible plugins? how to make your plugin extensible? examples of good practice

Slide 8

Slide 8 text

markwilkinson.me | @wpmark this talk will cover what is extensibility? why should you be making extensible plugins? how to make your plugin extensible? examples of good practice

Slide 9

Slide 9 text

markwilkinson.me | @wpmark this talk will cover what is extensibility? why should you be making extensible plugins? how to make your plugin extensible? examples of good practice

Slide 10

Slide 10 text

markwilkinson.me | @wpmark this talk will cover what is extensibility? why should you be making extensible plugins? how to make your plugin extensible? examples of good practice

Slide 11

Slide 11 text

markwilkinson.me | @wpmark Plugin and / or Theme

Slide 12

Slide 12 text

markwilkinson.me | @wpmark Extensible Plugins

Slide 13

Slide 13 text

markwilkinson.me | @wpmark “one that can be modified or extended without changing the plugin code itself ”

Slide 14

Slide 14 text

markwilkinson.me | @wpmark why?

Slide 15

Slide 15 text

markwilkinson.me | @wpmark https://www.flickr.com/photos/damndirty/10166197684

Slide 16

Slide 16 text

markwilkinson.me | @wpmark preserve future updatability

Slide 17

Slide 17 text

markwilkinson.me | @wpmark how?

Slide 18

Slide 18 text

markwilkinson.me | @wpmark actions & filters

Slide 19

Slide 19 text

markwilkinson.me | @wpmark do_action()

Slide 20

Slide 20 text

markwilkinson.me | @wpmark do_action( $tag, $args );

Slide 21

Slide 21 text

markwilkinson.me | @wpmark add_action()

Slide 22

Slide 22 text

markwilkinson.me | @wpmark add_action( $hook, $function, $priority, $accepted_args );

Slide 23

Slide 23 text

markwilkinson.me | @wpmark example

Slide 24

Slide 24 text

markwilkinson.me | @wpmark $q = new WP_Query( $q_args ); while( $q->have_posts() ) : $->the_post(); ?>

Slide 25

Slide 25 text

markwilkinson.me | @wpmark $q = new WP_Query( $q_args ); while( $q->have_posts() ) : $->the_post(); do_action( ‘wpmark_before_post’, get_the_ID() ); ?>

Slide 26

Slide 26 text

markwilkinson.me | @wpmark $q = new WP_Query( $q_args ); while( $q->have_posts() ) : $->the_post(); do_action( ‘wpmark_before_post’, get_the_ID() ); ?>

Slide 27

Slide 27 text

markwilkinson.me | @wpmark function wpmark_add_before_post( $post_id ) { $meta = get_post_meta( $post_id, ‘key’, true ); /* do something with $meta */ } add_action( ‘wpmark_before_post’, ‘wpmark_add_before_post’, 10, 1 );

Slide 28

Slide 28 text

markwilkinson.me | @wpmark apply_filters()

Slide 29

Slide 29 text

markwilkinson.me | @wpmark apply_filters( $tag, $value, $var );

Slide 30

Slide 30 text

markwilkinson.me | @wpmark add_filter()

Slide 31

Slide 31 text

markwilkinson.me | @wpmark add_filter( $hook, $function, $priority, $accepted_args );

Slide 32

Slide 32 text

markwilkinson.me | @wpmark example

Slide 33

Slide 33 text

markwilkinson.me | @wpmark $q_args = array( 'post_type' => ’post', 'cat' => 1 );

Slide 34

Slide 34 text

markwilkinson.me | @wpmark $q_args = apply_filters( ‘wpmark_q_args’, array( ‘post_type’ => ‘post’, ‘cat’ => 1 ) );

Slide 35

Slide 35 text

markwilkinson.me | @wpmark function wpmark_edit_q_args( $args ) { $args[ ‘year’ ] = ‘2014’; return $args; } add_filter( ‘wpmark_q_args’, ‘wpmark_edit_q_args’ 10, 1 );

Slide 36

Slide 36 text

markwilkinson.me | @wpmark conclusion

Slide 37

Slide 37 text

markwilkinson.me | @wpmark when making plugins & themes, remember to…

Slide 38

Slide 38 text

markwilkinson.me | @wpmark do_action() & apply_filters()

Slide 39

Slide 39 text

markwilkinson.me | @wpmark Thank you! Questions: @wpmark (or now!) Slides: markwilkinson.me (soon!)