20
CUSTOMIZING THE WORDPRESS CUSTOMIZER Jason Yingling | @jason_yingling | jasonyingling.me

Customizing the WordPress Customizer

Embed Size (px)

Citation preview

Page 1: Customizing the WordPress Customizer

CUSTOMIZING THEWORDPRESS CUSTOMIZERJason Yingling | @jason_yingling | jasonyingling.me

Page 2: Customizing the WordPress Customizer

Sliding container of

sections.

Panels

Page 3: Customizing the WordPress Customizer

Groups of options.

Controls are added to

sections.

Sections

Page 4: Customizing the WordPress Customizer

Where a customizer control stores it’s data.

Ex. The selected hex value of a color picker.

Settings

Page 5: Customizing the WordPress Customizer

An HTML form element

displayed in a

customizer section

allowing a setting to be

updated.

Control

Page 6: Customizing the WordPress Customizer

Define customize_register action

Page 7: Customizing the WordPress Customizer

Adding a Panel

Page 8: Customizing the WordPress Customizer

Adding a Section

Page 9: Customizing the WordPress Customizer

Adding a Setting

Page 10: Customizing the WordPress Customizer

Sanitizing Data

sanitize_text_field()

sanitize_hex_color()

sanitize_hex_color_nohash()

Plenty more:

https://codex.wordpress.org/Data_Validation

Page 11: Customizing the WordPress Customizer

Transport: refresh vs postMessage

refresh - causes the page to ajax reload when control

is updated

postMessage - Allows for live updating through JavaScript

when control is updated

Page 12: Customizing the WordPress Customizer

Adding a Control

Page 13: Customizing the WordPress Customizer

Types of ControlsWP_Customize_Control()

Creates a control that allows users to enter plain text. This is also the parent class for the classes that follow.

WP_Customize_Color_Control()

Creates a control that allows users to select a color from a color wheel.

WP_Customize_Upload_Control()

Creates a control that allows users to upload media.

WP_Customize_Image_Control()

Creates a control that allows users to select or upload an image.

WP_Customize_Background_Image_Control()

Creates a control that allows users to select a new background image.

WP_Customize_Header_Image_Control()

Creates a control that allows users to select a new header image.

Page 14: Customizing the WordPress Customizer

Outputting CSS with wp_head

Page 15: Customizing the WordPress Customizer

Live Updating Settings

Page 16: Customizing the WordPress Customizer

Changing Settings

Page 17: Customizing the WordPress Customizer

Moving Controls to Different Sections

Page 18: Customizing the WordPress Customizer

Removing Sections

Page 19: Customizing the WordPress Customizer

19

- https://codex.wordpress.org/Theme_Cus

tomization_API

- Team Treehouse

- @jason_yingling

- [email protected]

Questions &

Resources

Page 20: Customizing the WordPress Customizer