SlideShare a Scribd company logo
drewf.us/wcyvr13
Customizer-ing Theme Options:
AVisual Playground
WordCampVancouver 2013
Saturday, August 17, 13
drewf.us/wcyvr13
About Me
Drew Jaynes
Web Engineer, 10up
Core/Docs Contributor
@DrewAPicture
Saturday, August 17, 13
drewf.us/wcyvr13
The Customizer?
Saturday, August 17, 13
drewf.us/wcyvr13
.org Customizer-ers
Customizer
Theme Options
Saturday, August 17, 13
drewf.us/wcyvr13
Why does it matter?
Visual options are visual ... or they should be
Saturday, August 17, 13
drewf.us/wcyvr13
Customizer API
Sections Settings Controls
Saturday, August 17, 13
drewf.us/wcyvr13
customize_register
function my_theme_customizer( $wp_customize ) {
// do magic
}
add_action( 'customize_register', 'my_theme_customizer' );
Saturday, August 17, 13
drewf.us/wcyvr13
add_section()
$wp_customize->add_section( 'my_general_settings', array(
'title' => __( 'General Settings', 'textdomain' ),
'priority' => 40
) );
Saturday, August 17, 13
drewf.us/wcyvr13
add_setting()
$wp_customize->add_setting( 'nubrick_site_width', array(
'default' => 860
) );
Saturday, August 17, 13
drewf.us/wcyvr13
add_control()
$wp_customize->add_control( 'my_site_width', array(
'label' => __( 'Site Width', 'textdomain' ),
'section' => 'my_site_settings'
'settings' => 'my_site_width'
) );
Saturday, August 17, 13
drewf.us/wcyvr13
One Setting
$wp_customize->add_section( 'my_general_settings', array(
'title' => __( 'General Settings', 'textdomain' ),
'priority' => 40
) );
$wp_customize->add_setting( 'my_site_width', array(
'default' => 860
) );
$wp_customize->add_control( 'my_site_width', array(
'label' => __( 'Site Width', 'textdomain' ),
'section' => 'my_general_settings'
'settings' => 'my_site_width'
) );
Saturday, August 17, 13
drewf.us/wcyvr13
More add_setting()
Settings Types
– ‘option’
– ‘theme_mod’ (default)
echo get_theme_mod( 'my_setting' );
$settings = get_option( ‘my_settings’ );
echo $settings[‘my_setting’];
Saturday, August 17, 13
drewf.us/wcyvr13
To Refresh or Not to Refresh
Settings Transports
– refresh (default)
– postMessage
Saturday, August 17, 13
drewf.us/wcyvr13
To Refresh or Not to Refresh
postMessage Transport
– Specified with the ‘transport’ argument in add_setting()
$wp_customize->add_setting( 'nubrick_site_width', array(
'default' => 860,
'transport' => ‘postMessage’
) );
$wp_customize->get_setting( 'blogname' )->transport =
'postMessage';
– Change built-in controls’ transports
Saturday, August 17, 13
drewf.us/wcyvr13
To Refresh or Not to Refresh
postMessage Transport
– Asynchronous updates using JavaScript
( function( $ ) {
// Site title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '.site-title a' ).text( to );
} );
} );
} )( jQuery );
– Enqueue scripts on the ‘customize_preview_init’ hook
Saturday, August 17, 13
drewf.us/wcyvr13
Built-in Controls
Text
Dropdown Pages
Images
Colors
Saturday, August 17, 13
drewf.us/wcyvr13
Custom Controls
Saturday, August 17, 13
drewf.us/wcyvr13
Custom Controls
function my_theme_customizer( $wp_customize ) {
class My_Customize_Control extends WP_Customize_Control {
// do magic
}
$wp_customize->add_control( new My_Customize_Control( $wp_customize,
'my_setting', array(
'label' => __( 'My Setting', 'textdomain' ),
'section' => 'my_section',
'settings' => 'my_setting'
) ) );
}
add_action( 'customize_register', 'my_theme_customizer' );
Saturday, August 17, 13
drewf.us/wcyvr13
Resources
Ottopress.com (Otto42)
– Customizer API series published last year
WordPress Theme Customizer Controls (paulund)
– https://github.com/paulund/Wordpress-Theme-Customizer-Custom-Controls
WordPress Theme Customizer Boilerplate (slobodan)
– https://github.com/slobodan/WordPress-Theme-Customizer-Boilerplate
Saturday, August 17, 13
drewf.us/wcyvr13
Fun with the Customizer
Saturday, August 17, 13
drewf.us/wcyvr13
Case Study:Twenty Twelve Child Theme
Saturday, August 17, 13
drewf.us/wcyvr13
Thanks. Questions?
Drew Jaynes
@DrewAPicture
10up.com
Saturday, August 17, 13

More Related Content

PDF
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
PDF
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
PDF
How to eat Cucmber
PPTX
Auto tools
PDF
Vue.js SSR with Nuxt.js and Firebase
PDF
UI@Docker
PDF
jQuery - 10 Time-Savers You (Maybe) Don't Know
PDF
Getting Creative with WordPress Queries
Build tons of multi-device JavaScript applications - Part 1 : Boilerplate, de...
Build tons of multi-device JavaScript applications - Part 2 : (black) Magic S...
How to eat Cucmber
Auto tools
Vue.js SSR with Nuxt.js and Firebase
UI@Docker
jQuery - 10 Time-Savers You (Maybe) Don't Know
Getting Creative with WordPress Queries

Similar to Customizer-ing Theme Options: A Visual Playground (20)

PDF
Developing for the WordPress Customizer
PDF
Using The WordPress Customizer
PDF
Developing For The WordPress Customizer
PDF
The Customizer
PDF
WordPress Customizer
PDF
Customize it.
PDF
WordPress customizer: for themes and more
PDF
Creating Customizer Options for Themes and Plugins
PDF
WordPress 3.4 Theme Customizer
PDF
Theme Customization
PPTX
Theme customization
PDF
A Designers Approach to Customizing Themes
PPTX
Customizing the WordPress Customizer
PDF
WordCamp Praga 2015
PDF
WordPress Sunshine Coast Customizer
PPTX
WordPress customizer for themes and more
PDF
Using Wordpress with Reclaim Hosting
PPTX
Wordpress - S03.L03 - Customizing the Theme
PPTX
Think Before You Submit Themes on WordPress dot Org
PPTX
Customizing WordPress Themes
Developing for the WordPress Customizer
Using The WordPress Customizer
Developing For The WordPress Customizer
The Customizer
WordPress Customizer
Customize it.
WordPress customizer: for themes and more
Creating Customizer Options for Themes and Plugins
WordPress 3.4 Theme Customizer
Theme Customization
Theme customization
A Designers Approach to Customizing Themes
Customizing the WordPress Customizer
WordCamp Praga 2015
WordPress Sunshine Coast Customizer
WordPress customizer for themes and more
Using Wordpress with Reclaim Hosting
Wordpress - S03.L03 - Customizing the Theme
Think Before You Submit Themes on WordPress dot Org
Customizing WordPress Themes
Ad

More from DrewAPicture (11)

PDF
WordPress Development in a Modern PHP World
PDF
WordPress Development in a Modern PHP World
PDF
Getting Creative with WordPress Queries, Again
PDF
How to Win Friends and Influence WordPress Core
PDF
Trying Out Tomorrow’s WordPress Today
PDF
It Takes a Village to Make WordPress
PDF
Setting Up WordPress: A NUX Case Study
PDF
Core Docs: Sentencing WordPress to 11-years-to-life
PDF
Putting the (docs) Cart Before the (standards) Horse
PDF
There's a Filter For That
PDF
Anatomy of the WordPress Loop
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP World
Getting Creative with WordPress Queries, Again
How to Win Friends and Influence WordPress Core
Trying Out Tomorrow’s WordPress Today
It Takes a Village to Make WordPress
Setting Up WordPress: A NUX Case Study
Core Docs: Sentencing WordPress to 11-years-to-life
Putting the (docs) Cart Before the (standards) Horse
There's a Filter For That
Anatomy of the WordPress Loop
Ad

Recently uploaded (20)

PDF
BRANDBOOK-Presidential Award Scheme-Kenya-2023
PPTX
AC-Unit1.pptx CRYPTOGRAPHIC NNNNFOR ALL
PDF
Africa 2025 - Prospects and Challenges first edition.pdf
PDF
Trusted Executive Protection Services in Ontario — Discreet & Professional.pdf
PPT
Package Design Design Kit 20100009 PWM IC by Bee Technologies
DOCX
actividad 20% informatica microsoft project
PDF
Phone away, tabs closed: No multitasking
PDF
Key Trends in Website Development 2025 | B3AITS - Bow & 3 Arrows IT Solutions
PPT
pump pump is a mechanism that is used to transfer a liquid from one place to ...
PPTX
BSCS lesson 3.pptxnbbjbb mnbkjbkbbkbbkjb
DOCX
The story of the first moon landing.docx
PDF
GREEN BUILDING MATERIALS FOR SUISTAINABLE ARCHITECTURE AND BUILDING STUDY
PDF
Urban Design Final Project-Site Analysis
PPTX
Causes of Flooding by Slidesgo sdnl;asnjdl;asj.pptx
PPTX
AD Bungalow Case studies Sem 2.pptxvwewev
PPTX
Complete Guide to Microsoft PowerPoint 2019 – Features, Tools, and Tips"
PPTX
Implications Existing phase plan and its feasibility.pptx
PDF
Integrated-2D-and-3D-Animation-Bridging-Dimensions-for-Impactful-Storytelling...
PPTX
areprosthodontics and orthodonticsa text.pptx
PDF
Interior Structure and Construction A1 NGYANQI
BRANDBOOK-Presidential Award Scheme-Kenya-2023
AC-Unit1.pptx CRYPTOGRAPHIC NNNNFOR ALL
Africa 2025 - Prospects and Challenges first edition.pdf
Trusted Executive Protection Services in Ontario — Discreet & Professional.pdf
Package Design Design Kit 20100009 PWM IC by Bee Technologies
actividad 20% informatica microsoft project
Phone away, tabs closed: No multitasking
Key Trends in Website Development 2025 | B3AITS - Bow & 3 Arrows IT Solutions
pump pump is a mechanism that is used to transfer a liquid from one place to ...
BSCS lesson 3.pptxnbbjbb mnbkjbkbbkbbkjb
The story of the first moon landing.docx
GREEN BUILDING MATERIALS FOR SUISTAINABLE ARCHITECTURE AND BUILDING STUDY
Urban Design Final Project-Site Analysis
Causes of Flooding by Slidesgo sdnl;asnjdl;asj.pptx
AD Bungalow Case studies Sem 2.pptxvwewev
Complete Guide to Microsoft PowerPoint 2019 – Features, Tools, and Tips"
Implications Existing phase plan and its feasibility.pptx
Integrated-2D-and-3D-Animation-Bridging-Dimensions-for-Impactful-Storytelling...
areprosthodontics and orthodonticsa text.pptx
Interior Structure and Construction A1 NGYANQI

Customizer-ing Theme Options: A Visual Playground