Building applications with WordPress [WordCamp NYC 2016]

Preview:

Citation preview

Building Applications with WordPress

Steve BrunerWordCamp NYC

July 17, 2016

Me…Steve Bruner

WordPress Developer 10+ years

Active community member

WordPress NYC Meetup: since August 2008

WordCamp NYC: 2009, 2010, 2012, 2014

Co-Developer of: Piklist [plugin]

Rapid Development Framework

Build powerful websites and applications with WordPress

WordCamp NYC 2009

Presented a Contact Manager Theme:

RoloPress

Piklist.com

Examples

WooCommerce

Easy Digital Downloads

CiviCRM

BuddyPress

Invoicing

Contact Manager

Internal Workflow

....As WP Engine continues its torrid growth amidst strong customer demand, it has to

keep finding ways to deliver world -class support to every customer every day. That

means continually improving existing tools and building new ones – quickly.

“I have a laundry list of about 40

WordPress dev projects just for this quarter,”

Hoanshelt said. “So whenever my team is gearing up for the next one, my Project

Manager jokes, ‘Just Piklist it.’”

Piklist Customer Success: WP Engine

https://piklist.com/case-study/piklist-customer-success-wp-engine/

Process

1. Build a minimal viable product (MVP)

2. Measure for user behavior

3. Learn for the next iteration

Disable Front-end

Why?

Do you need a theme for your application?

wp-admin is:

Secure

Responsive

Controlled environment

Disable Front-end

How?

function my_no_front_end() {

if( !is_admin() ) { wp_redirect( admin_url() ); exit;}

}add_action( 'wp', 'my_no_front_end' );

Change Admin Menu

Why?

Does your application need the default WordPress items?

A cleaner admin is easier to navigate.

Don’t make your users work around WordPress.

How?

Plugin: https://wordpress.org/plugins/admin-menu-editor/

Manipulate: global $menu, $submenu;

Replace Core Settings Pages

Why?

Do the default settings pages make sense for your application?

A cleaner admin is easier to navigate.

Replace Core Settings Pages

How?

Plugin: https://wordpress.org/plugins/admin-menu-editor/

Remove page: remove_submenu_page()

Just hides it. Redirect to your new page.

Add new page: add_submenu_page()

Do not use settings api… saves as a serialized array.

Use update_option()

Create Roles and Capabilities

Why?

Usually different than standard blog roles.

How?

Plugin: Members

Members

Disable Author Pages

Why?

Employees are now authors.

Don’t need their own pages.

How?

Plugin: Disable Author Pages

Custom Post Statuses

Why?

Default statuses may not be appropriate for your application.

e.g. “Publish”, “Draft”, etc.

Examples: “New Order”, “Received”, “Shipped”, etc.

How?

register_post_status()

Registers new post status, but doesn’t change admin UI

Validate and Sanitize FieldsWhy?

Garbage in… garbage out.

Trust no one.How?

sanitize_* functions

wp_kses functions

esc_ * functions

Validate with conditionals.

Javascript not as secure as server-side validation

Save Empty Fields

Why?

Empty fields are a value.

Makes it easy to loop over data.

Consistency in your object.

“If you choose not to decide, you still have made a choice”

Rush - Freewill

Understand your dataWhy?

Make sure it is in a useable format.

You may want to query it.

How?

Save data normally:

One row per field.

Maybe a serialized array is not the best choice?

Name your meta keys something meaningful.

Look in your database…make sure you understand the data.

Tooltip Help

Why?

Explain expected field input.

Give users independence.

Fewer support calls.

How?

jQuery UI

CSS

Dashboard Widgets

Why?

Provide application overview: Sales, Open Orders, etc.

Tailor to logged in user.

How?

https://codex.wordpress.org/Dashboard_Widgets_API

Piklistpiklist.com

Custom post statuses

Field validation and sanitization

Tooltip help

Dashboard widgets

Replace core settings pages

Display fields based on post status/user role

Infinite repeater fields.

Object relationships

Multiple user roles

Widgets and shortcodes

And much more...

Twitter: @sbrunerWebsite: piklist.com