SlideShare a Scribd company logo
1 of 19
Download to read offline
Jonny Allbut / Head of Digital
Custom theme building
structures & techniques
to save your sanity!
Handover and assets
• Work with your creative - you’re a team!
• Establish scope of front-end early
• Keep on-board as project evolves
• Don’t start coding until creative all signed off
• Colour palettes & image/vector assets
• Image sizes
@wearewider
wider.co.uk
Colour palette
@wearewider
wider.co.uk
#1580ba
RGB: 21/128/186
.col-tertiary-3
#2f505a
RGB: 47/80/90
.col-secondary-dark
#0b97ae
RGB: 11/151/174
.col-secondary-mid
#6fe5e9
RGB: 111/229/233
.col-secondary
#738a8d
RGB: 115/138/141
.col-primary-light
#31b7bc
RGB: 49/183/188
.col-primary-dark
#63ceca
RGB: 99/206/202
.col-primary
Tymly Web Colour Palette v1.3
#e4e4e4
RGB: 228/228/228
.col-mid
#fff
RGB: 255/255/255
.col-lightest
#f1f1f1
RGB: 241/241/241
.col-light
#323232
RGB: 50/50/50
.col-dark
#000
RGB: 0/0/0
.col-darkest
How we build sites
• Theme framework (parent theme) with child theme
• Supporting bespoke plugins
• EXTREMELY limited 3rd party plugins
• Carefully selected applicable third-party JS
• Our own front-end JS UI library
• Our own ‘theme toolbox’ plugin:
• Navigation
• Content output and formatting
• Taxonomy
• Navigation/menus
@wearewider
wider.co.uk
Initialising the project
• Alfred for automation
• Checklist built into starter stack
• Text strings to replace
• Initial graphics to generate
• Notes on initial setup
• Pitfalls and other tasks not to forget
• Go-live checklist
@wearewider
wider.co.uk
TIP: Keeping it local
add_action( 'after_setup_theme', 'mywfx_environment', 1 );
function mywfx_environment() {
$live = array(
'https://wider-vanilla2.com',
'https://approval.wider.co.uk/vanilla2'
);
$this_env = get_home_url( 1 );
$this_env = ( in_array( $this_env, $live ) ) ? 'live' : 'dev';
define( 'MY_WFX_ENV', $this_env );
}
@wearewider
wider.co.uk
Graphic assets
• Version control editable asset files (really!)
• Nucleo custom web fonts + our own override CSS
• CSS to the rescue!
• Version strings break cache:

$theme_v = wp_get_theme()->get( 'Version' );
@wearewider
wider.co.uk
TIP: Custom image sizes for editors
add_filter( 'image_size_names_choose', ‘mywfx_editor_custom_images' );
function mywfx_editor_custom_images( $args ) {
$exclude = array(
'portrait-med-tn',
'landscape-tiny'
);
$images = array();
global $_wp_additional_image_sizes;
if ( !empty($_wp_additional_image_sizes) ) {
foreach ( $_wp_additional_image_sizes as $key => $value ) {
if ( !in_array($key,$exclude) ) {
$images[ $key ] = ucwords( str_replace( '-', ' ', $key ) );
}
}
return array_merge( $args, $images );
}
}
@wearewider
wider.co.uk
File structure
@wearewider
wider.co.uk
assets
acf
blocks
config
css
editable-assets
favicons
fonts
forms
images
js
functions
admin
functions-data.php
functions-head.php
functions-media.php
functions-navigation.php
functions-query.php
functions-scripts.php
functions-supporting.php
functions-template-parts.php
functions-wp-config.php
functions-third-party.php
functions-wonderflux.php
assets
functions
parts
footer-content.php
functions.php
header-content.php
loop-content-archive.php
loop-content-archive-news.php
loop-content-no-search-results.php
loop-content.php
sidebar-content.php
screenshot.png
style.css
checklist.txt
theme
Configuration files
@wearewider
wider.co.uk
theme > assets > config
colour-palettes.php
contacts.php
plugin-config.php
post-types.php
taxonomies.php
Template parts
@wearewider
wider.co.uk
part-content-posts-latest.php
part-content-service-funnels.php
part-content-side-image.php
part-content-standard.php
part-content-video.php
part-footer-contact-leads.php
part-nav-primary.php
part-nav-secondary.php
theme > parts
part-archive-filters.php
part-content-accordions.php
part-content-bg-img-feature.php
part-content-contact-leads.php
part-content-form.php
part-content-image.php
part-content-map.php
part-content-carousel.php
part-content-multi-column.php
Main functions
@wearewider
wider.co.uk
theme > functions
functions-scripts.php
functions-supporting.php
functions-template-parts.php
functions-theme-config.php
functions-third-party.php
functions-wonderflux.php
admin
functions-data.php
functions-head.php
functions-media.php
functions-menus.php
functions-query.php
Admin functions
@wearewider
wider.co.uk
theme > functions > admin
functions-admin-bar-menu.php
functions-admin.php
functions-content-saving.php
functions-text-support.php
functions-wp-admin-lists.php
functions-wp-editor.php
functions-wp-user.php
TIP: Escaping more complex content
wp_kses( $text, wfx_allowed_simple_tags( ‘text’ ) )

$arr = array (
'span' => array(
'class'=>array(),
‘id'=>array()
),
'br' => array()
);
• wp_kses_post( $data )
• wp_kses_post_deep( $data )
• wp_filter_nohtml_kses( $data )
@wearewider
wider.co.uk
Outputting content
• Build output at top of file, keep output section clean
• Consider building an output array
• Escape EVERYTHING… never trust any user content!
• Escape output at latest point possible
• Use built-in output functions like:
• esc_html()
• esc_attr()
• Remember _e variants too - esc_html_e()
@wearewider
wider.co.uk
TIP: Output array example
$query_args = array(
‘post_type' => strtolower( $type ),
‘posts_per_page' => 4,
‘orderby' => 'date'
);
$output = array();
$the_query = new WP_Query( $query_args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
$this_id = get_the_ID();
$output[$this_id][‘terms'] = mywfx_get_all_terms( $this_id, 'news-topic', false );
$output[$this_id]['image'] = wfx_get_image( ‘id=img_archive&size=archive&field=post_meta’ );
$output[$this_id]['title'] = get_the_title();
$output[$this_id]['excerpt'] = wfx_excerpt( 'limit=17&excerpt_end=...&echo=N' );
$output[$this_id]['link'] = get_the_permalink();
$output[$this_id]['date'] = mywfx_clean_date_output( get_the_date(), ‘date_short' );
endwhile;
endif;
wp_reset_postdata();
@wearewider
wider.co.uk
Avoiding pitfalls
• Don’t repeat yourself (DRY)
• Don’t over-engineer
• Don’t re-invent the wheel, does WordPress do it already?
• Have a great debug function - see wfx_debug()
• Don’t be scared of space - write legible code!
• Refactor as you go, or mark as todo task
• Test early, test often
• Be conscious of optimisation, but leave mostly until end
• Have 2 or more monitors… have a ‘crap’ colour setting!
@wearewider
wider.co.uk
Our Tools of the trade
• Development
• MampPro for local server
• Espresso for editing CSS
• Nucleo for icon font generation
(Fontello wasn’t bad either!)
• Sublime/Atom for coding
• Sequel Pro for MySQL databases
• Supporting
• Alfred for automation
• Tower for Version control/GIT
• DeployHQ for auto-deployment to
dev and live servers
• Testing
• Browser Stack for testing 

different browsers
• WAVE and Siteimprove for
accessibility checks
• Web Developer for various tasks
(validation/colour checks/turning
off JS/CSS etc)
• Optimisation
• Codekit for minification/checking
• ImageOptim for image compression
@wearewider
wider.co.uk
wider-co.uk / @wearewider
Custom theme building
structures & techniques
to save your sanity!

More Related Content

What's hot

How else can you write the code in PHP?
How else can you write the code in PHP?How else can you write the code in PHP?
How else can you write the code in PHP?Maksym Hopei
 
Drupal Lightning FAPI Jumpstart
Drupal Lightning FAPI JumpstartDrupal Lightning FAPI Jumpstart
Drupal Lightning FAPI Jumpstartguestfd47e4c7
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress sitereferences
 
Perlmagickを使った画像処理
Perlmagickを使った画像処理Perlmagickを使った画像処理
Perlmagickを使った画像処理Toshimitsu YAMAGUCHI
 
Beyond the Final Frontier of jQuery Selectors
Beyond the Final Frontier of jQuery SelectorsBeyond the Final Frontier of jQuery Selectors
Beyond the Final Frontier of jQuery SelectorsAlexander Shopov
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress WebsitesKyle Cearley
 
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesDesarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesLuis Curo Salvatierra
 
Mastering Custom Post Types - WordCamp Atlanta 2012
Mastering Custom Post Types - WordCamp Atlanta 2012Mastering Custom Post Types - WordCamp Atlanta 2012
Mastering Custom Post Types - WordCamp Atlanta 2012Mike Schinkel
 
WordPress Theme Workshop: Sidebars
WordPress Theme Workshop: SidebarsWordPress Theme Workshop: Sidebars
WordPress Theme Workshop: SidebarsDavid Bisset
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptxCurtis Poe
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPVineet Kumar Saini
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Thinqloud
 

What's hot (20)

How else can you write the code in PHP?
How else can you write the code in PHP?How else can you write the code in PHP?
How else can you write the code in PHP?
 
Drupal Lightning FAPI Jumpstart
Drupal Lightning FAPI JumpstartDrupal Lightning FAPI Jumpstart
Drupal Lightning FAPI Jumpstart
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress site
 
Drawing images
Drawing imagesDrawing images
Drawing images
 
Perlmagickを使った画像処理
Perlmagickを使った画像処理Perlmagickを使った画像処理
Perlmagickを使った画像処理
 
Beyond the Final Frontier of jQuery Selectors
Beyond the Final Frontier of jQuery SelectorsBeyond the Final Frontier of jQuery Selectors
Beyond the Final Frontier of jQuery Selectors
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 
Wp meetup custom post types
Wp meetup custom post typesWp meetup custom post types
Wp meetup custom post types
 
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesDesarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móviles
 
Mastering Custom Post Types - WordCamp Atlanta 2012
Mastering Custom Post Types - WordCamp Atlanta 2012Mastering Custom Post Types - WordCamp Atlanta 2012
Mastering Custom Post Types - WordCamp Atlanta 2012
 
WordPress Theme Workshop: Sidebars
WordPress Theme Workshop: SidebarsWordPress Theme Workshop: Sidebars
WordPress Theme Workshop: Sidebars
 
The Customizer
The CustomizerThe Customizer
The Customizer
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptx
 
The jQuery Divide
The jQuery DivideThe jQuery Divide
The jQuery Divide
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
Images and PWA in magento
Images and PWA in magentoImages and PWA in magento
Images and PWA in magento
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...
 

Similar to WordCamp Bristol 2019 - WordPress custom theme building

DBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちDBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちRyo Miyake
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018Adam Tomat
 
Blunt Umbrellas Website Showcase
Blunt Umbrellas Website ShowcaseBlunt Umbrellas Website Showcase
Blunt Umbrellas Website ShowcaseGareth Hall
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Adam Darowski
 
You're Doing it Wrong - WordCamp Atlanta
You're Doing it Wrong - WordCamp AtlantaYou're Doing it Wrong - WordCamp Atlanta
You're Doing it Wrong - WordCamp AtlantaChris Scott
 
Responsive WordPress workflow
Responsive WordPress workflowResponsive WordPress workflow
Responsive WordPress workflowJames Bundey
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress DeveloperJoey Kudish
 
WordPress Cuztom Helper
WordPress Cuztom HelperWordPress Cuztom Helper
WordPress Cuztom Helperslicejack
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) ThemingPINGV
 
Introdução a CSS
Introdução a CSS Introdução a CSS
Introdução a CSS Tiago Santos
 
Ten modules I haven't yet talked about
Ten modules I haven't yet talked aboutTen modules I haven't yet talked about
Ten modules I haven't yet talked aboutacme
 
Rewriting the Drupal Theme layer
Rewriting the Drupal Theme layerRewriting the Drupal Theme layer
Rewriting the Drupal Theme layerc4rl
 
Element Styles and Positioning
Element Styles and PositioningElement Styles and Positioning
Element Styles and Positioningalexisabril
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid PrototypingEven Wu
 

Similar to WordCamp Bristol 2019 - WordPress custom theme building (20)

DBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちDBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たち
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018
 
Css3
Css3Css3
Css3
 
Blunt Umbrellas Website Showcase
Blunt Umbrellas Website ShowcaseBlunt Umbrellas Website Showcase
Blunt Umbrellas Website Showcase
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
 
You're Doing it Wrong - WordCamp Atlanta
You're Doing it Wrong - WordCamp AtlantaYou're Doing it Wrong - WordCamp Atlanta
You're Doing it Wrong - WordCamp Atlanta
 
Responsive WordPress workflow
Responsive WordPress workflowResponsive WordPress workflow
Responsive WordPress workflow
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 
WordPress Cuztom Helper
WordPress Cuztom HelperWordPress Cuztom Helper
WordPress Cuztom Helper
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Seven deadly theming sins
Seven deadly theming sinsSeven deadly theming sins
Seven deadly theming sins
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) Theming
 
Introdução a CSS
Introdução a CSS Introdução a CSS
Introdução a CSS
 
Ten modules I haven't yet talked about
Ten modules I haven't yet talked aboutTen modules I haven't yet talked about
Ten modules I haven't yet talked about
 
Rewriting the Drupal Theme layer
Rewriting the Drupal Theme layerRewriting the Drupal Theme layer
Rewriting the Drupal Theme layer
 
Element Styles and Positioning
Element Styles and PositioningElement Styles and Positioning
Element Styles and Positioning
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 

More from Jonny Allbut

Your Online Marketing 
& Social Media Toolkit - Wider
Your Online Marketing 
& Social Media Toolkit - WiderYour Online Marketing 
& Social Media Toolkit - Wider
Your Online Marketing 
& Social Media Toolkit - WiderJonny Allbut
 
WordCamp Manchester 2016 - Making WordPress Menus Smarter
WordCamp Manchester 2016 - Making WordPress Menus SmarterWordCamp Manchester 2016 - Making WordPress Menus Smarter
WordCamp Manchester 2016 - Making WordPress Menus SmarterJonny Allbut
 
How to use WordPress
How to use WordPressHow to use WordPress
How to use WordPressJonny Allbut
 
How to create and develop a winning brand
How to create and develop a winning brandHow to create and develop a winning brand
How to create and develop a winning brandJonny Allbut
 
WordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshopWordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshopJonny Allbut
 
WordCamp Birmingham 2015 - Theme building tricks of the trade
WordCamp Birmingham 2015 - Theme building tricks of the tradeWordCamp Birmingham 2015 - Theme building tricks of the trade
WordCamp Birmingham 2015 - Theme building tricks of the tradeJonny Allbut
 
WordCamp Bournemouth 2014 - Designing with data in WordPress
WordCamp Bournemouth 2014 - Designing with data in WordPressWordCamp Bournemouth 2014 - Designing with data in WordPress
WordCamp Bournemouth 2014 - Designing with data in WordPressJonny Allbut
 
WordCamp Sheffield 2014 Theme Workflow Presentation
WordCamp Sheffield 2014 Theme Workflow PresentationWordCamp Sheffield 2014 Theme Workflow Presentation
WordCamp Sheffield 2014 Theme Workflow PresentationJonny Allbut
 
Build WordPress themes like a heavyweight - WordCamp Lancaster 2013
Build WordPress themes like a heavyweight - WordCamp Lancaster 2013Build WordPress themes like a heavyweight - WordCamp Lancaster 2013
Build WordPress themes like a heavyweight - WordCamp Lancaster 2013Jonny Allbut
 
Rapid WordPress theme development
Rapid WordPress theme developmentRapid WordPress theme development
Rapid WordPress theme developmentJonny Allbut
 
Turbo charged WordPress theme development - WordCamp Edinburgh 2012
Turbo charged WordPress theme development - WordCamp Edinburgh 2012Turbo charged WordPress theme development - WordCamp Edinburgh 2012
Turbo charged WordPress theme development - WordCamp Edinburgh 2012Jonny Allbut
 
Freelance presentation v2
Freelance presentation v2Freelance presentation v2
Freelance presentation v2Jonny Allbut
 
Wordcamp 2010 presentation
Wordcamp 2010 presentationWordcamp 2010 presentation
Wordcamp 2010 presentationJonny Allbut
 
WordCamp UK 2009 presentation
WordCamp UK 2009 presentationWordCamp UK 2009 presentation
WordCamp UK 2009 presentationJonny Allbut
 
WordPress Is Not A Blog from WordCamp UK 2008
WordPress Is Not A Blog from WordCamp UK 2008WordPress Is Not A Blog from WordCamp UK 2008
WordPress Is Not A Blog from WordCamp UK 2008Jonny Allbut
 

More from Jonny Allbut (15)

Your Online Marketing 
& Social Media Toolkit - Wider
Your Online Marketing 
& Social Media Toolkit - WiderYour Online Marketing 
& Social Media Toolkit - Wider
Your Online Marketing 
& Social Media Toolkit - Wider
 
WordCamp Manchester 2016 - Making WordPress Menus Smarter
WordCamp Manchester 2016 - Making WordPress Menus SmarterWordCamp Manchester 2016 - Making WordPress Menus Smarter
WordCamp Manchester 2016 - Making WordPress Menus Smarter
 
How to use WordPress
How to use WordPressHow to use WordPress
How to use WordPress
 
How to create and develop a winning brand
How to create and develop a winning brandHow to create and develop a winning brand
How to create and develop a winning brand
 
WordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshopWordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshop
 
WordCamp Birmingham 2015 - Theme building tricks of the trade
WordCamp Birmingham 2015 - Theme building tricks of the tradeWordCamp Birmingham 2015 - Theme building tricks of the trade
WordCamp Birmingham 2015 - Theme building tricks of the trade
 
WordCamp Bournemouth 2014 - Designing with data in WordPress
WordCamp Bournemouth 2014 - Designing with data in WordPressWordCamp Bournemouth 2014 - Designing with data in WordPress
WordCamp Bournemouth 2014 - Designing with data in WordPress
 
WordCamp Sheffield 2014 Theme Workflow Presentation
WordCamp Sheffield 2014 Theme Workflow PresentationWordCamp Sheffield 2014 Theme Workflow Presentation
WordCamp Sheffield 2014 Theme Workflow Presentation
 
Build WordPress themes like a heavyweight - WordCamp Lancaster 2013
Build WordPress themes like a heavyweight - WordCamp Lancaster 2013Build WordPress themes like a heavyweight - WordCamp Lancaster 2013
Build WordPress themes like a heavyweight - WordCamp Lancaster 2013
 
Rapid WordPress theme development
Rapid WordPress theme developmentRapid WordPress theme development
Rapid WordPress theme development
 
Turbo charged WordPress theme development - WordCamp Edinburgh 2012
Turbo charged WordPress theme development - WordCamp Edinburgh 2012Turbo charged WordPress theme development - WordCamp Edinburgh 2012
Turbo charged WordPress theme development - WordCamp Edinburgh 2012
 
Freelance presentation v2
Freelance presentation v2Freelance presentation v2
Freelance presentation v2
 
Wordcamp 2010 presentation
Wordcamp 2010 presentationWordcamp 2010 presentation
Wordcamp 2010 presentation
 
WordCamp UK 2009 presentation
WordCamp UK 2009 presentationWordCamp UK 2009 presentation
WordCamp UK 2009 presentation
 
WordPress Is Not A Blog from WordCamp UK 2008
WordPress Is Not A Blog from WordCamp UK 2008WordPress Is Not A Blog from WordCamp UK 2008
WordPress Is Not A Blog from WordCamp UK 2008
 

Recently uploaded

Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 

Recently uploaded (20)

Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 

WordCamp Bristol 2019 - WordPress custom theme building

  • 1. Jonny Allbut / Head of Digital Custom theme building structures & techniques to save your sanity!
  • 2. Handover and assets • Work with your creative - you’re a team! • Establish scope of front-end early • Keep on-board as project evolves • Don’t start coding until creative all signed off • Colour palettes & image/vector assets • Image sizes @wearewider wider.co.uk
  • 3. Colour palette @wearewider wider.co.uk #1580ba RGB: 21/128/186 .col-tertiary-3 #2f505a RGB: 47/80/90 .col-secondary-dark #0b97ae RGB: 11/151/174 .col-secondary-mid #6fe5e9 RGB: 111/229/233 .col-secondary #738a8d RGB: 115/138/141 .col-primary-light #31b7bc RGB: 49/183/188 .col-primary-dark #63ceca RGB: 99/206/202 .col-primary Tymly Web Colour Palette v1.3 #e4e4e4 RGB: 228/228/228 .col-mid #fff RGB: 255/255/255 .col-lightest #f1f1f1 RGB: 241/241/241 .col-light #323232 RGB: 50/50/50 .col-dark #000 RGB: 0/0/0 .col-darkest
  • 4. How we build sites • Theme framework (parent theme) with child theme • Supporting bespoke plugins • EXTREMELY limited 3rd party plugins • Carefully selected applicable third-party JS • Our own front-end JS UI library • Our own ‘theme toolbox’ plugin: • Navigation • Content output and formatting • Taxonomy • Navigation/menus @wearewider wider.co.uk
  • 5. Initialising the project • Alfred for automation • Checklist built into starter stack • Text strings to replace • Initial graphics to generate • Notes on initial setup • Pitfalls and other tasks not to forget • Go-live checklist @wearewider wider.co.uk
  • 6. TIP: Keeping it local add_action( 'after_setup_theme', 'mywfx_environment', 1 ); function mywfx_environment() { $live = array( 'https://wider-vanilla2.com', 'https://approval.wider.co.uk/vanilla2' ); $this_env = get_home_url( 1 ); $this_env = ( in_array( $this_env, $live ) ) ? 'live' : 'dev'; define( 'MY_WFX_ENV', $this_env ); } @wearewider wider.co.uk
  • 7. Graphic assets • Version control editable asset files (really!) • Nucleo custom web fonts + our own override CSS • CSS to the rescue! • Version strings break cache:
 $theme_v = wp_get_theme()->get( 'Version' ); @wearewider wider.co.uk
  • 8. TIP: Custom image sizes for editors add_filter( 'image_size_names_choose', ‘mywfx_editor_custom_images' ); function mywfx_editor_custom_images( $args ) { $exclude = array( 'portrait-med-tn', 'landscape-tiny' ); $images = array(); global $_wp_additional_image_sizes; if ( !empty($_wp_additional_image_sizes) ) { foreach ( $_wp_additional_image_sizes as $key => $value ) { if ( !in_array($key,$exclude) ) { $images[ $key ] = ucwords( str_replace( '-', ' ', $key ) ); } } return array_merge( $args, $images ); } } @wearewider wider.co.uk
  • 10. Configuration files @wearewider wider.co.uk theme > assets > config colour-palettes.php contacts.php plugin-config.php post-types.php taxonomies.php
  • 11. Template parts @wearewider wider.co.uk part-content-posts-latest.php part-content-service-funnels.php part-content-side-image.php part-content-standard.php part-content-video.php part-footer-contact-leads.php part-nav-primary.php part-nav-secondary.php theme > parts part-archive-filters.php part-content-accordions.php part-content-bg-img-feature.php part-content-contact-leads.php part-content-form.php part-content-image.php part-content-map.php part-content-carousel.php part-content-multi-column.php
  • 12. Main functions @wearewider wider.co.uk theme > functions functions-scripts.php functions-supporting.php functions-template-parts.php functions-theme-config.php functions-third-party.php functions-wonderflux.php admin functions-data.php functions-head.php functions-media.php functions-menus.php functions-query.php
  • 13. Admin functions @wearewider wider.co.uk theme > functions > admin functions-admin-bar-menu.php functions-admin.php functions-content-saving.php functions-text-support.php functions-wp-admin-lists.php functions-wp-editor.php functions-wp-user.php
  • 14. TIP: Escaping more complex content wp_kses( $text, wfx_allowed_simple_tags( ‘text’ ) )
 $arr = array ( 'span' => array( 'class'=>array(), ‘id'=>array() ), 'br' => array() ); • wp_kses_post( $data ) • wp_kses_post_deep( $data ) • wp_filter_nohtml_kses( $data ) @wearewider wider.co.uk
  • 15. Outputting content • Build output at top of file, keep output section clean • Consider building an output array • Escape EVERYTHING… never trust any user content! • Escape output at latest point possible • Use built-in output functions like: • esc_html() • esc_attr() • Remember _e variants too - esc_html_e() @wearewider wider.co.uk
  • 16. TIP: Output array example $query_args = array( ‘post_type' => strtolower( $type ), ‘posts_per_page' => 4, ‘orderby' => 'date' ); $output = array(); $the_query = new WP_Query( $query_args ); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); $this_id = get_the_ID(); $output[$this_id][‘terms'] = mywfx_get_all_terms( $this_id, 'news-topic', false ); $output[$this_id]['image'] = wfx_get_image( ‘id=img_archive&size=archive&field=post_meta’ ); $output[$this_id]['title'] = get_the_title(); $output[$this_id]['excerpt'] = wfx_excerpt( 'limit=17&excerpt_end=...&echo=N' ); $output[$this_id]['link'] = get_the_permalink(); $output[$this_id]['date'] = mywfx_clean_date_output( get_the_date(), ‘date_short' ); endwhile; endif; wp_reset_postdata(); @wearewider wider.co.uk
  • 17. Avoiding pitfalls • Don’t repeat yourself (DRY) • Don’t over-engineer • Don’t re-invent the wheel, does WordPress do it already? • Have a great debug function - see wfx_debug() • Don’t be scared of space - write legible code! • Refactor as you go, or mark as todo task • Test early, test often • Be conscious of optimisation, but leave mostly until end • Have 2 or more monitors… have a ‘crap’ colour setting! @wearewider wider.co.uk
  • 18. Our Tools of the trade • Development • MampPro for local server • Espresso for editing CSS • Nucleo for icon font generation (Fontello wasn’t bad either!) • Sublime/Atom for coding • Sequel Pro for MySQL databases • Supporting • Alfred for automation • Tower for Version control/GIT • DeployHQ for auto-deployment to dev and live servers • Testing • Browser Stack for testing 
 different browsers • WAVE and Siteimprove for accessibility checks • Web Developer for various tasks (validation/colour checks/turning off JS/CSS etc) • Optimisation • Codekit for minification/checking • ImageOptim for image compression @wearewider wider.co.uk
  • 19. wider-co.uk / @wearewider Custom theme building structures & techniques to save your sanity!