Build WordPress themes like a heavyweight - WordCamp Lancaster 2013
1. Jonny Allbut Head of Digital - Tanc Design
@Jonnyauk | www.tancdesign.com
Build themes
like a Heavyweight
2. Howdy Campers!
Creative designer & developer
Working with WordPress since early 2005
Creator & lead developer of:
Wonderflux theme framework
WP-CMS Post Control
Tanc Dimensions Helper
Avid theme developer, intermediate PHP coder
3. Why build your own themes?
Build for purpose
Consistent development
No compromises
Build for the future
Performance
4. My theme build workflow
Establish business priorities
Rationalise content structure
Widgetise/menus/post types
Creative design
Layout coding
Custom functions
Extra views
7. The trouble with responsive
Huge audience
Layout and media content
Should we be designing mobile first?
Pixel perfection?
What's wrong with how it’s (often) done?
8. The quest for the holy grail
The shortcomings of the Wonderflux grid
Gutters are for drunks!
Browser detection
Extra browser classes on body tag
Moving div generation to 'relative' sized div PHP
function with responsive over-ride
10. CSS tricks of the trade
Use/abuse the body class
<body <?php body_class('extraclass');?>>
Use/abuse the post class
<?php post_class('extraclass'); ?>>
Use what WordPress gives you for free
(if your themes built right!)
13. PHP tricks of the trade
is_page_template()
has_post_thumbnail()
Detecting last post
Adding your own image sizes
Checking if widget area populated
Custom walker class for menus
14. Testing for page template
if (is_page_template('template-2-column-sb-left.php')) {
//Means we need to go for wider columns
$columnsize = '18';
$columnsizecontent = '14';
} else {
//Normal columns
$columnsize = '12';
$columnsizecontent = '8';
}
15. Testing for post thumbnail
if ( !has_post_thumbnail() ) {
$this_img_single =
get_bloginfo('stylesheet_directory').
'/images/default-thumbnail.jpg';
}
16. Detecting last post
if( ($wp_query->current_post + 1) < ($wp_query-
>post_count) ): echo ‘This is the end!’;