Wordpress development 101

34
WORDPRESS DEVELOPMENT 101 June 16, 2016 Commit University Tirane

Transcript of Wordpress development 101

Page 1: Wordpress development 101

WORDPRESSDEVELOPMENT 101

June 16, 2016 Commit University

Tirane

Page 2: Wordpress development 101

I AM MATTEO MAZZONIWeb Developer - since 2005

ICT Consultant - since 2007

OS Java Developer - Freedomotic.com - since 2012

Married, father of 2

Climbing addicted

Page 3: Wordpress development 101

BackgroundDeployment constraints for the perfect website

Page 4: Wordpress development 101

ASPECTS WEB DEVELOPERS HAVE TO ORCHESTRATE

VERSATILE Content

Management

GREATUser

eXperienceEASY

maintainablity

EXTREME customization

CONTINUOUS Evolution

Page 5: Wordpress development 101

WHICH SOLUTION BETTER FITS OUR NEEDS ?

Page 6: Wordpress development 101

TAILORED

CONS:more difficult to mantain,

time consuming, more expensive,all problems are

up to developers

PROS: Fully cover people’s needs, can be adapted to futureopportunities

Page 7: Wordpress development 101

INTEGRATE AND ADAPT

PROS:Pick and integrate State Of The Art solutions, build reusable skills, customize what’s necessary

CONS:data is bound to

original model and deep adaption tend to

be a mess

Page 8: Wordpress development 101

WHICH SOLUTION BETTER FITS OUR NEEDS ?

INTEGRATE AND ADAPT SHOWCASE NOT DATA CENTEREDQUICKLY EXTEND

TAILOREDDATA CENTEREDCUSTOM WORKFLOWS

Page 9: Wordpress development 101

WE’RE GOING DOWN THE RABBIT’S HOLE AND...

Get to knowWordpress

Explore its architecture

Solve real problems

LET’S SUPPOSE WE GOT THE RED PILL…

Page 10: Wordpress development 101

WORDPRESS main features

EASE OF USE PLUGINS THEMES

SUPPORT LIGHTWEIGHT

Page 11: Wordpress development 101

Wordpress The story so far

2001 - born as B22003 - forked as Wordpress2004 - Plugins are introduced 2005 - Theme system and static pages are introduced 2007 - A new UI, autosave, spell check, widgets2009 - introduced a built-in theme installer2010 - Custom post types, custom taxonomies. Multisite2012 - Introduced the theme customizer and theme previewer.2013 - Builtin Audio and Video, Revisions, Automatic updates.2015 - Responsiveness

https://codex.wordpress.org/History

Page 12: Wordpress development 101

WE’RE GOING TO...

Get to knowWordpress

Explore its architecture

Solve real problems

Dig into WP’s architecture, in order to gain experience on all its features.

Page 13: Wordpress development 101

“Wordpress is just a blog with steroids”GPdT

Page 14: Wordpress development 101

HOW COULD IT BE SUCH VERSATILE?

Page 15: Wordpress development 101

HOW COULD WP BE SUCH VERSATILE?

SIMPLE YET POWERFUL DATABASE STRUCTURE

Page 16: Wordpress development 101

HOW COULD WP BE SUCH VERSATILE?

POSTSTRUCTURE

Page 17: Wordpress development 101

HOW COULD WP BE SUCH VERSATILE?

TAXONOMIES

Page 18: Wordpress development 101

HOW COULD WP BE SUCH VERSATILE?Hooks, Actions, Filters

Every WP activity (e.g. generating a web page) is made of many stages.

Developers can intercept and extend

those stages in order to

accomplish their goals

HOW ?

Page 19: Wordpress development 101

HOW COULD WP BE SUCH VERSATILE?

HOOKS -> STAGES of page rendering

ACTIONS functions (to be hooked somewhere) that do something

e.g. extend footer data in order to show a credit string

function copyright_note() { echo '<p>Credits 2016 &copyright;</p>';}add_action( 'wp_footer', ‘copyright_note' );

Page 20: Wordpress development 101

HOW COULD WP BE SUCH VERSATILE?

HOOKS -> STAGES of page rendering

FILTERS functions (to be hooked somewhere) that WP passes data through

e.g. check if a new subscriber uses unallowed characters in his username

function my_sanitize_user($user, $raw_user, $strict) { # ...}add_filter('sanitize_user', 'my_sanitize_user', 10, 3);

Page 21: Wordpress development 101

HOW COULD WP BE SUCH VERSATILE?17 internal API Categories19 Action Categories9 Filter Categories

HOW MANY HOOKS?

http://adambrown.info/p/wp_hooks

Page 22: Wordpress development 101

They do nothing but mixing

- Hook extensions- API Calls

PLUGINS

Page 23: Wordpress development 101

Themes mainly redefine page layouts and ease customization.Page templates are defined/overridden using a specific file hyerarchy

e.g./wp-content/themes/my_theme/single.php/wp-content/themes/my_theme/single-product.php/wp-content/themes/my_theme/category.php

THEMES

Page 24: Wordpress development 101

THEMES - Template hyerarchy

Page 25: Wordpress development 101

WE’RE GOING TO...

Get to knowWordpress

Explore its architecture

Solve real problems

Learn how to leverage such features and solve common problems using elegant, simple, long lasting solutions.

Page 26: Wordpress development 101

Before we start

0- Have you got Wordpress?- Install suggested theme

- And required plugins- Get a few plugins:

- Woocommerce- Custom Post Types UI- Child Theme Configurator

- Create a page and set as homepage

Ready!

Page 27: Wordpress development 101

Problem:

1People want a super stylish, responsive, full-featured layout.

Workflow:- Choose the right theme- Configure it- Adapt css to your needs- Should you need deeper customization,

make a child theme and rely on HOOKS

Page 28: Wordpress development 101

Problem:

2People have their own data to showcase

Workflow:- Create a new post type- Deploy related taxonomies- Extend posts with extra fields*- Write custom templates

*too much extra fields? Take the blue pill!

Page 29: Wordpress development 101

Problem:

3People want to introduce extra features

Workflow:- Identify right hooks - Identify involved API calls- Collect functions in a plugin

Page 30: Wordpress development 101

Problem:

4Theme updates could destroy our customization work, but they are fundamental for our blog security and user experience.

Workflow:- Get used to everyday (weekly) updates- Make a child theme- Update main theme as usual

Page 31: Wordpress development 101

Problem:

5Keeping a optimal user experience and help us mantain the whole platform with less pain.

Workflow:- Get used to everyday (weekly) updates- Check page load speed and issues- Deploy a caching system (WP plugin or memcache)- Check page speed (again..)- Adapt server-side params to fix/improve

Page 32: Wordpress development 101

What comes next, depends on you...

Resume

We learnt to:- adapt WP themes- create customized content types- write plugins- modify WP behavior using Hooks/Actions/Filters- enforce maintainability and robustness (in behalf of

software upgrades)- manage basic site optimization as a pre-production task

Page 33: Wordpress development 101

ANY QUESTION?

You can find me at http://blog.bestmazzo.it@[email protected]

Page 34: Wordpress development 101

CREDITS

Special thanks to:◇ SlidesCarnival : Presentation template ◇ Gabriel Pulido de Torres: quotes and priceless suggestions