Slide 1

Slide 1 text

DRY Theme Development Matt Radford 10degrees.uk

Slide 2

Slide 2 text

.warning { color: #FF0000; } @alert: #FF0000; .warning { color: @alert; }

Slide 3

Slide 3 text

OMG_massive_unwieldy.css _normalise.less _grid.less _mixins.less _typography.less _variables.less _urgh_IE.less lovely.min.css

Slide 4

Slide 4 text

Modularity

Slide 5

Slide 5 text

Don’t Repeat Yourself

Slide 6

Slide 6 text

themble.com/bones

Slide 7

Slide 7 text

bones - theme directory

Slide 8

Slide 8 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 9

Slide 9 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 10

Slide 10 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 11

Slide 11 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 12

Slide 12 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 13

Slide 13 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 14

Slide 14 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 15

Slide 15 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 16

Slide 16 text

role="article">

%2$s ' . __('by', 'bonestheme' ) . ' %3$s', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>

bones - index.php

Slide 17

Slide 17 text

page.php archive.php page-custom.php archive-custom_type.php search.php single.php single-custom_type.php taxonomy-custom_cat.php 404.php header.php footer.php sidebar.php comments.php

Slide 18

Slide 18 text

Slide 19

Slide 19 text

locate_template() http://codex.wordpress.org/Function_Reference/locate_template

Slide 20

Slide 20 text

Slide 21

Slide 21 text

“Load a template part into a template (other than header, sidebar, footer). Makes it easy for a theme to reuse sections of code and an easy way for child themes to replace sections of their parent theme.” http://codex.wordpress.org/Function_Reference/get_template_part

Slide 22

Slide 22 text

roots.io

Slide 23

Slide 23 text

roots - theme directory

Slide 24

Slide 24 text

bones vs roots - fight!

Slide 25

Slide 25 text

roots - index.php !
! ! max_num_pages > 1) : ?>

Slide 26

Slide 26 text

roots - index.php !
! ! max_num_pages > 1) : ?>

Slide 27

Slide 27 text

roots - header.php
! 'primary_navigation', 'menu_class' => 'nav navbar-nav')); endif; ?>

Slide 28

Slide 28 text

roots - head.php > <?php wp_title('|', true, 'right'); ?> ! !

Slide 29

Slide 29 text

roots - base.php > !
! !

Slide 30

Slide 30 text

Template Hierarchy Base! .php

Slide 31

Slide 31 text

base.php —> locate_template()

Slide 32

Slide 32 text

! http://roots.io/an-introduction-to-the-roots- theme-wrapper/ http://scribu.net/wordpress/theme- wrappers.html

Slide 33

Slide 33 text

! Questions: @mattradford Slides: mattrad.uk Contribute: github.com/mattradford/DRY-bones 10degrees.uk