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
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
91
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エンジニアの役割分担についてのある事例
kworkdev
PRO
1
350
日本Rubyの会: これまでとこれから
snoozer05
PRO
6
250
AIBuildersDay_track_A_iidaxs
iidaxs
4
1.7k
Cloud WAN MCP Serverから考える新しいネットワーク運用 / 20251228 Masaki Okuda
shift_evolve
PRO
0
130
_第4回__AIxIoTビジネス共創ラボ紹介資料_20251203.pdf
iotcomjpadmin
0
170
AI駆動開発ライフサイクル(AI-DLC)の始め方
ryansbcho79
0
280
Strands Agents × インタリーブ思考 で変わるAIエージェント設計 / Strands Agents x Interleaved Thinking AI Agents
takanorig
6
2.5k
Redshift認可、アップデートでどう変わった?
handy
1
120
Kiro を用いたペアプロのススメ
taikis
4
2.1k
モダンデータスタックの理想と現実の間で~1.3億人Vポイントデータ基盤の現在地とこれから~
taromatsui_cccmkhd
2
290
Entity Framework Core におけるIN句クエリ最適化について
htkym
0
140
2025年 山梨の技術コミュニティを振り返る
yuukis
0
140
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Navigating Weather and Climate Data
rabernat
0
60
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
270
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Discover your Explorer Soul
emna__ayadi
2
1k
sira's awesome portfolio website redesign presentation
elsirapls
0
99
Applied NLP in the Age of Generative AI
inesmontani
PRO
3
2k
WENDY [Excerpt]
tessaabrams
9
35k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
A Soul's Torment
seathinner
1
2.1k
エンジニアに許された特別な時間の終わり
watany
106
220k
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