Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Using the WordPress Customizer to Build Beautif...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Patrick Rauland
May 08, 2015
Technology
2
1.1k
Using the WordPress Customizer to Build Beautiful Plugin Settings Pages
Using the Customizer at LoopConf
Patrick Rauland
May 08, 2015
Tweet
Share
More Decks by Patrick Rauland
See All by Patrick Rauland
Google Analytics for Clients
bftrick
0
140
Black Friday 2020: Your Biggest Sales Day Yet
bftrick
1
100
10 Uncommon (& Weird) Ways to Prevent Fights
bftrick
0
230
WooCommerce and You - A Love Story - WordCamp Minneapolis 2018
bftrick
0
98
Live Your Life Like a Supervillain
bftrick
0
180
Ninja Gravity Form 7
bftrick
0
91
Are Robots Coming for Your Job?
bftrick
0
93
Scoping eCommerce Projects
bftrick
0
290
Accounting basics you need to get to a $1M+ seller
bftrick
0
140
Other Decks in Technology
See All in Technology
AI推進者の視点で見る、Bill OneのAI活用の今
sansantech
PRO
1
130
re:Inventで見つけた「運用を捨てる」技術。
ezaki
1
150
セキュリティ はじめの一歩
nikinusu
0
540
一番人に近いコードレビューア CodeRabbit
kinopeee
0
110
2026年はチャンキングを極める!
shibuiwilliam
7
1.2k
SMTP完全に理解した ✉️
yamatai1212
0
110
2人で作ったAIダッシュボードが、開発組織の次の一手を照らした話― Cursor × SpecKit × 可視化の実践 ― Qiita AI Summit
noalisaai
0
110
オープンウェイトのLLMリランカーを契約書で評価する / searchtechjp
sansan_randd
0
180
OCI技術資料 : OS管理ハブ 概要
ocise
2
4.3k
The Engineer with a Three-Year Cycle - 2
e99h2121
0
190
SwiftDataを覗き見る
akidon0000
0
310
日本語テキストと音楽の対照学習の技術とその応用
lycorptech_jp
PRO
1
290
Featured
See All Featured
A Tale of Four Properties
chriscoyier
162
24k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
570
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
My Coaching Mixtape
mlcsv
0
41
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
160
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
160
エンジニアに許された特別な時間の終わり
watany
106
230k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
83
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
110
Thoughts on Productivity
jonyablonski
74
5k
Transcript
Using the WordPress Customizer to Build Beautiful Plugin Settings Pages
Patrick Rauland @BFTrick
None
Reading Can Be Difficult
No matter how clearly you write people will misinterpret your
words.
None
None
None
None
None
None
7 Steps to Hijack the Customizer
1. Create a Button That Loads the Customizer
// get customizer url $url = admin_url( 'customize.php' );
array( 'title' => __( 'Customize!', 'woocommerce' ), 'desc' => __(
'Customize your product archive pages with the WordPress Customizer.', 'woocommerce' ), 'type' => 'wc_button', 'link' => $url ) WooCommerce Settings API: http://docs.woothemes.com/ document/settings-api/
None
2. Load a Specific Page
// get special page $shop_page_url = get_permalink( wc_get_page_id( 'shop' )
); // if we have a shop page go straight to it // the default will load the home page if ( $shop_page_url ) { $url = add_query_arg( 'url', urlencode( $shop_page_url ), $url ); }
None
3. Add a Return URL
// get the return page $url = add_query_arg( 'return', urlencode(
add_query_arg( array( 'page' => 'wc-settings', 'tab' => 'email' ), admin_url( 'admin.php' ) ) ), $url );
None
4. Add a Flag in Customizer URL
$url = add_query_arg( 'wc-email-customizer', 'true', $url );
5. Hide Default Controls
add_filter( 'customize_control_active', 'control_filter', 10, 2 ); function control_filter( $active, $control
) { if ( in_array( $control->section, array( 'wc_email_header', 'wc_email_body', 'wc_email_footer', 'wc_email_send' ) ) ) { return true; } return false; }
global $wp_customize; $wp_customize->remove_section( 'themes' );
None
6. Add New controls
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'wc_email_header_image_control', array( 'label' => __( 'Upload
a Header', 'woocommerce' ), 'priority' => 10, 'section' => 'wc_email_header', 'settings' => 'woocommerce_email_header_image', ) ) );
// autofocus a section $url = add_query_arg( 'autofocus[section]', '{name of
your section}', $url );
None
7. Save Settings as Plugin Options
$wp_customize->add_setting( 'wc_email_background_color', array( 'type' => 'option', 'default' => '#f5f5f5', 'transport'
=> 'postMessage', ) );
None
No matter how clearly you write people will misinterpret your
words
Using the Customizer allows you to show users what a
setting does
Patrick Rauland @BFTrick WooCommerce Product Manager WooThemes