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

Preview:

DESCRIPTION

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

Citation preview

SO YOU WANT TO BUILD AND RELEASE A PLUGIN…

Ryan DuffWordCamp Lancaster 2014

ABOUT ME

•Long time WordPress user

•Plugin Developer

•Meetup Organizer

A BIT OF PLUGIN HISTORY

my-hacks.php

VERSION 1.2(May 22, 2004)

Plugin API

THINGS TO CONSIDER

YOUR CODE

FILTERS

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

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

EXAMPLE

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

);

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

ACTIONS

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

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

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' );

INTERNATIONALIZATION

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' );

PLUGIN SETTINGS

http://themeoptions.wordpress.com/

OTHER CONSIDERATIONS

•Code style

•Documentation

•Errors

PLUGIN LICENSE

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

PLUGIN HOSTING

•WordPress.org

•GitHub

•Both?

QUESTIONS?

RYAN DUFF

RYAN@FUSIONIZED.COM

@RYANCDUFF

Recommended