Slide 1

Slide 1 text

@onishiweb Cleaner Themes Persil Case Study

Slide 2

Slide 2 text

@onishiweb

Slide 3

Slide 3 text

@onishiweb

Slide 4

Slide 4 text

@onishiweb 2 to give away

Slide 5

Slide 5 text

@onishiweb

Slide 6

Slide 6 text

@onishiweb Code Examples

Slide 7

Slide 7 text

@onishiweb Beginner / Expert

Slide 8

Slide 8 text

@onishiweb The project

Slide 9

Slide 9 text

@onishiweb The project: ‣ WordPress backend ‣ 35+ Markets Worldwide ‣ Multi-language support ‣ Customisable per market - features, styling, etc ‣ Manageable by local teams ‣ Integrate with external campaigns

Slide 10

Slide 10 text

@onishiweb The solution... ‣ Work with a team of developers ‣ Modify styles/functionality on a per-site basis ‣ Managed through a simple codebase ‣ Easy to keep up to date and easy to deploy ‣ Extendible when necessary

Slide 11

Slide 11 text

@onishiweb Tools

Slide 12

Slide 12 text

‣ Multisite ‣ Parent/Child Themes ‣ Git ‣ Frontend Tools - Sass/Compass/Grunt ‣ Plugins @onishiweb Tools

Slide 13

Slide 13 text

@onishiweb Multisite

Slide 14

Slide 14 text

@onishiweb Centrally managed system

Slide 15

Slide 15 text

@onishiweb Easily create new sites

Slide 16

Slide 16 text

@onishiweb Got a bit messed up...

Slide 17

Slide 17 text

@onishiweb Parent/Child Themes

Slide 18

Slide 18 text

@onishiweb 1 core parent theme

Slide 19

Slide 19 text

@onishiweb Child themes https://codex.wordpress.org/Child_Themes

Slide 20

Slide 20 text

‣ Functions file ‣ Pluggable functions ‣ Post type & taxonomy slugs ‣ Mail settings @onishiweb Child theme config

Slide 21

Slide 21 text

if( ! function_exists('dig_mail_from_address') ) : function dig_mail_from_address( $old ) { return '[email protected]'; } endif; add_filter('wp_mail_from', 'dig_mail_from_address'); @onishiweb

Slide 22

Slide 22 text

function dig_mail_from_address( $old ) { return '[email protected]'; } @onishiweb

Slide 23

Slide 23 text

@onishiweb Always child theme!

Slide 24

Slide 24 text

@onishiweb Git

Slide 25

Slide 25 text

@onishiweb USE IT! http://git-scm.com/book/en/Getting-Started http://gitimmersion.com/ http://alistapart.com/article/get-started-with-git

Slide 26

Slide 26 text

@onishiweb A successful Git branching model http://nvie.com/posts/a-successful-git-branching-model/

Slide 27

Slide 27 text

@onishiweb Frontend Tools

Slide 28

Slide 28 text

@onishiweb Sass/Compass

Slide 29

Slide 29 text

@onishiweb Sass & Compass benefits ‣ Easier to work in collaboration ‣ More modular way of writing styles ‣ Makes working with child themes a breeze ‣ Good for performance ‣ Easily modify base styles

Slide 30

Slide 30 text

@onishiweb

Slide 31

Slide 31 text

@onishiweb

Slide 32

Slide 32 text

@onishiweb Grunt

Slide 33

Slide 33 text

‣ JSHint ‣ Concatenation ‣ Minification ‣ Image optimisation ‣ Compass compliation @onishiweb Grunt tasks

Slide 34

Slide 34 text

@onishiweb Icon Fonts

Slide 35

Slide 35 text

@onishiweb http://fontastic.me/

Slide 36

Slide 36 text

@onishiweb Plugins

Slide 37

Slide 37 text

@onishiweb Advanced Custom Fields http://www.advancedcustomfields.com/

Slide 38

Slide 38 text

‣ Repeater Field ‣ Options Pages ‣ Flexible Content Field @onishiweb ACF Add-ons

Slide 39

Slide 39 text

@onishiweb WordPress Multilingual http://wpml.org/ http://translate-toolkit.readthedocs.org/en/latest/commands/csv2po.html

Slide 40

Slide 40 text

@onishiweb WordPress SEO (Yoast) https://wordpress.org/plugins/wordpress-seo/

Slide 41

Slide 41 text

@onishiweb WordPress Social Login http://wordpress.org/plugins/wordpress-social-login/

Slide 42

Slide 42 text

@onishiweb Content

Slide 43

Slide 43 text

@onishiweb Custom Post Types

Slide 44

Slide 44 text

@onishiweb 5 main 3 supporting

Slide 45

Slide 45 text

@onishiweb Custom Taxonomies

Slide 46

Slide 46 text

@onishiweb

Slide 47

Slide 47 text

@onishiweb Configured per market

Slide 48

Slide 48 text

$count = 1; foreach( $tax_labels as $slug => $labels ) { $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => $slug ), ); register_taxonomy( 'dig_product_filter_' . $count, 'dig_product', $args ); $count++; } @onishiweb

Slide 49

Slide 49 text

@onishiweb Custom Fields

Slide 50

Slide 50 text

@onishiweb ACF...

Slide 51

Slide 51 text

@onishiweb Modular content made easy

Slide 52

Slide 52 text

@onishiweb

Slide 53

Slide 53 text

@onishiweb $75!

Slide 54

Slide 54 text

@onishiweb $75 AUD!

Slide 55

Slide 55 text

@onishiweb The Theme

Slide 56

Slide 56 text

@onishiweb Theme organisation

Slide 57

Slide 57 text

@onishiweb Folders are your friend!

Slide 58

Slide 58 text

/css /javascript /inc /inc/admin /inc/template-tags /templates /template-parts @onishiweb

Slide 59

Slide 59 text

@onishiweb The template hierarchy extends into subdirectories http://nacin.com/2012/03/29/page-templates-in-subdirectories-new-in-wordpress-3-4/

Slide 60

Slide 60 text

// For /pages/page-contact.php // Will return ‘pages/page-contact.php’ @onishiweb

Slide 61

Slide 61 text

@onishiweb Templating

Slide 62

Slide 62 text

@onishiweb Template parts

Slide 63

Slide 63 text

@onishiweb

Slide 64

Slide 64 text

@onishiweb Separating logic from templates

Slide 65

Slide 65 text

@onishiweb

Slide 66

Slide 66 text

@onishiweb Custom template tags

Slide 67

Slide 67 text

if( ! function_exists( 'dig_get_post_type_title' ) ) : function dig_get_post_type_title() { if( is_tag() ) { $query = get_queried_object(); return __('Topic: ', 'dirtisgood') . $query->name; } $type_name = dig_current_post_type(); if( '' !== $type_name ) { $post_type = get_post_type_object( $type_name ); return $post_type->labels->name; } } endif; @onishiweb

Slide 68

Slide 68 text

@onishiweb Custom templates

Slide 69

Slide 69 text

@onishiweb Best for i18n - no more page-xxxx.php

Slide 70

Slide 70 text

@onishiweb Ajax

Slide 71

Slide 71 text

@onishiweb admin-ajax.php http://www.smashingmagazine.com/2011/10/18/how-to-use-ajax-in-wordpress/

Slide 72

Slide 72 text

// Set up Nonce in the arguments args.nonce = coreData.ajaxData.postUserNonce; // Run ajax call $.ajax({ type: 'POST', dataType: 'json', url: coreData.ajaxData.ajaxurl, data: args, success: callback }); @onishiweb

Slide 73

Slide 73 text

/* <![CDATA[ */ var coreData = {"ajaxData":{"ajaxurl":"http:\/\/ www.persil.co.uk\/wp-admin\/admin- ajax.php","postUserNonce":"d11736ec4f"}}; /* ]]> */ @onishiweb

Slide 74

Slide 74 text

wp_enqueue_script( 'core', $javascript_file, 'jquery', '1.1.1', true ); $ajaxData = array( 'ajaxurl' => admin_url('admin-ajax.php' ), 'postUserNonce' => wp_create_nonce( 'ajax-users-nonce' ), ); wp_localize_script( 'core', 'coreData', $ajaxData ); @onishiweb

Slide 75

Slide 75 text

add_action('wp_ajax_sort_filter_articles', 'dig_ajax_process_archive'); add_action('wp_ajax_nopriv_sort_filter_articles', 'dig_ajax_process_archive'); @onishiweb

Slide 76

Slide 76 text

// Set up and send the response $response = json_encode(array( 'results' => true, 'pages' => $pages, 'data' => $data, )); die( $response ); @onishiweb

Slide 77

Slide 77 text

@onishiweb I18n and L10n

Slide 78

Slide 78 text

$labels = array( 'name' => __('Laundry Products', 'dirtisgood'), 'singular_name' => __('Product', 'dirtisgood'), [...] );

@onishiweb

Slide 79

Slide 79 text

$strings = array( 'close' => __('close', 'dirtisgood'), 'all' => __('All', 'dirtisgood'), 'both' => __('Both', 'dirtisgood'), [...] ); wp_localize_script( 'core', 'coreData', $localisations ); @onishiweb

Slide 80

Slide 80 text

@onishiweb Custom plugins

Slide 81

Slide 81 text

@onishiweb Reusable functionality

Slide 82

Slide 82 text

@onishiweb Easy to switch on/off

Slide 83

Slide 83 text

@onishiweb Menu

Slide 84

Slide 84 text

@onishiweb

Slide 85

Slide 85 text

@onishiweb Uses custom menus

Slide 86

Slide 86 text

@onishiweb

Slide 87

Slide 87 text

@onishiweb

Slide 88

Slide 88 text

@onishiweb Making use of JavaScript

Slide 89

Slide 89 text

@onishiweb Universal Navigation

Slide 90

Slide 90 text

@onishiweb Work in Progress!

Slide 91

Slide 91 text

@onishiweb Thanks! adamonishi.com twitter.com/onishiweb github.com/onishiweb