24
SO YOU WANT TO BUILD AND RELEASE A PLUGIN… Ryan Duff WordCamp Lancaster 2014

So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

Embed Size (px)

DESCRIPTION

My talk from WordCamp Lancaster 2014. Things to implement when preparing a plugin for public release.

Citation preview

Page 1: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

SO YOU WANT TO BUILD AND RELEASE A PLUGIN…

Ryan DuffWordCamp Lancaster 2014

Page 2: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

ABOUT ME

•Long time WordPress user

•Plugin Developer

•Meetup Organizer

Page 3: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

A BIT OF PLUGIN HISTORY

Page 4: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

my-hacks.php

Page 5: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

VERSION 1.2(May 22, 2004)

Page 6: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

Plugin API

Page 7: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

THINGS TO CONSIDER

Page 8: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

YOUR CODE

Page 9: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

FILTERS

Page 10: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

apply_filters( $tag, $value, $var ... )

http://codex.wordpress.org/Function_Reference/apply_filters

Page 11: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

EXAMPLE

$query_args = array('post_type' => 'books','posts_per_page' => 5,'author' => 3

);

$books = new WP_Query( apply_filters( 'wclanc_books_query', $query_args ) );

Page 12: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

ACTIONS

Page 13: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

do_action( $tag, $arg_a, $arg_b, $etc );

http://codex.wordpress.org/Function_Reference/do_action

Page 14: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

EXAMPLEdo_action( 'wclanc_books_before' );echo '<div class="wclanc_books">';

while( $books->have_posts() ) : $books->the_post()

echo '<div class="wclanc_book">';

do_action( 'wclanc_before_book_title', get_the_ID() );

echo '<h3 class="wclanc_book_title">' . get_the_title() . '</h3>';

do_action( 'wclanc_after_book_title', get_the_ID() );

echo '</div>';

endwhile;

echo '</div>';do_action( 'wclanc_books_after' );

Page 15: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

INTERNATIONALIZATION

Page 16: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

EXAMPLE

https://codex.wordpress.org/I18n_for_WordPress_Developers

/* * Plugin Name: i18n Test * Author: Ryan Duff * Text Domain: wclanc-i18n */

$text = __( ‘This is a test', ‘wclanc-i18n' );

_e( ‘This test will echo', ‘wclanc-i18n' );

Page 17: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

PLUGIN SETTINGS

http://themeoptions.wordpress.com/

Page 18: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

OTHER CONSIDERATIONS

•Code style

•Documentation

•Errors

Page 19: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

PLUGIN LICENSE

Page 20: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

COMMON LICENSES

•GPL v2/v3

•MIT (X11)

•Apache License v2

•WTFPL v2 1) http://wordpress.org/plugins/about/2) http://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses

Page 21: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

PLUGIN HOSTING

Page 22: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

•WordPress.org

•GitHub

•Both?

Page 23: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

QUESTIONS?

Page 24: So You Want to Build and Release a Plugin? WordCamp Lancaster 2014

RYAN DUFF

[email protected]

@RYANCDUFF