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
はじめてのプラグインのつくりかた
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Toro_Unit (Hiroshi Urabe)
December 02, 2017
Technology
1
190
はじめてのプラグインのつくりかた
WordBench 長野 vol.14 WordPress 勉強会 の登壇資料です。
Toro_Unit (Hiroshi Urabe)
December 02, 2017
Tweet
Share
More Decks by Toro_Unit (Hiroshi Urabe)
See All by Toro_Unit (Hiroshi Urabe)
ブロックテーマ、WordPress でウェブサイトをつくるということ / 2026.02.07 Gifu WordPress Meetup
torounit
0
200
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
480
ブロックテーマとこれからの WordPress サイト制作 / nishinomiya.dev@2025-12-21
torounit
1
250
ブロックテーマとこれからの WordPress サイト制作 / Toyama WordPress Meetup Vol.81
torounit
0
770
ブロックテーマ時代における、テーマの CSS について考える Toro_Unit / 2025.09.13 @ Shinshu WordPress Meetup
torounit
0
640
ブロックテーマでサイトリニューアルした話 / Toro_Unit / 2025.04.12 @ Shinshu WordPress Meetup
torounit
1
290
Cloudflare Meetup Nagano Vol.3
torounit
1
150
僕が考える 「HTML サイトを WordPress にする」話 / 2023-11-05 Kansai WordPress Meetup
torounit
9
7.9k
Cloudflare Pages に入門してみた / 2023-10-14 Cloudflare Meetup Nagano Vol.2
torounit
2
2.1k
Other Decks in Technology
See All in Technology
顧客の言葉を、そのまま信じない勇気
yamatai1212
1
360
10Xにおける品質保証活動の全体像と改善 #no_more_wait_for_test
nihonbuson
PRO
2
330
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
今こそ学びたいKubernetesネットワーク ~CNIが繋ぐNWとプラットフォームの「フラッと」な対話
logica0419
3
300
Cloud Runでコロプラが挑む 生成AI×ゲーム『神魔狩りのツクヨミ』の裏側
colopl
0
130
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
240
SRE Enabling戦記 - 急成長する組織にSREを浸透させる戦いの歴史
markie1009
0
160
AWS Network Firewall Proxyを触ってみた
nagisa53
1
240
登壇駆動学習のすすめ — CfPのネタの見つけ方と書くときに意識していること
bicstone
3
130
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
93k
SREチームをどう作り、どう育てるか ― Findy横断SREのマネジメント
rvirus0817
0
330
AzureでのIaC - Bicep? Terraform? それ早く言ってよ会議
torumakabe
1
600
Featured
See All Featured
Claude Code のすすめ
schroneko
67
210k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
140
The SEO identity crisis: Don't let AI make you average
varn
0
330
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
190
Test your architecture with Archunit
thirion
1
2.2k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
66
37k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
170
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
830
sira's awesome portfolio website redesign presentation
elsirapls
0
150
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
From π to Pie charts
rasagy
0
130
Transcript
͡ΊͯͷϓϥάΠϯͷͭ͘Γ͔ͨ Toro_Unit @2017.12.02 / WordBench Nagano vol 14. 1
$ whoami ͜͡͠ΐ͏͔͍ 2
Toro_Unit ෦ ߛ (͏Β ͻΖ͠) ϑϦʔϥϯε Frontend Engineer / Web
Designer Plugin and Theme Developer Github: @torounit Twitter: @Toro_Unit Facebook: fb.me/torounit Blog: https://torounit.com 3
Plugins. • Custom Post Type Permalinks • Active installations: 90,000+
• Downloads: 450,000 + • Simple Post Type Permalinks • Powerful Posts Per Page (PPPP) • Responsive Slide • and more... 4
Vanilla — Free WordPress Themes 5
Contribution • WordBench ϞσϨʔλʔ • WordCamp Kyoto 2017 /
Kansai 2016 / Tokyo 2016 • WordCamp Tokyo 2017 Speaker • WordBench.org • VCCW Team • etc... 6
WordPress Plugins • WordPress Λ֦ு͢Δػೳɻ • ެࣜϨϙδτϦʹɺ50000 Ҏ্ͷ ϓϥάΠϯ͕ܝࡌ͞Ε͍ͯΔɻ(ཧ ը໘͔ΒΠϯετʔϧग़དྷΔͭ)
7
ͪΖΜࣗ࡞Ͱ͖Δɻ 8
ࣗ࡞͢ΔϝϦοτ • ϓϥάΠϯʹͨ͠ํ͕ɺ͍ճ͕͠༰қɻ • ςʔϚͷfunctions.php ʹॻ͘ͱͪ͝Όͪ͝Ό͢Δ͠ɺςʔϚ Λม͑Δͱͦͷػೳ͕ࢮ͵ɻࡶͳ࡞ΓํΛͯ͠ΔͱαΠτ͕ յΕΔɻ 9
ϓϥάΠϯͷͭ͘Γ͔ͨ 10
1. PHP ϑΝΠϧΛ࡞ͯ͠ɺwp-content/plugins ʹஔɻ • plugins Լʹ php ϑΝΠϧΛஔ͍ͯOK͕ͩɺϓϥάΠϯͷϑΝΠϧ͕૿͑ͨΓ͢ΔͷͰɺσΟϨΫτϦΛ࡞ͬͯͦͷதʹ ೖΕͨ΄͏͕Θ͔Γ͍͢ɻ
11
2.PHPϑΝΠϧͷઌ಄ʹίϝϯτΛهड़ <?php /* Plugin Name: ͍͢͝ϓϥάΠϯ Plugin URI: https://example.org Description:
͍ͧ͢͝ʔ Author: Toro_Unit Version: 1.0.0 Author URI: https://torounit.com/ License: GPL2 or Later. */ ࠷ݶ Plugin Name ͕͋ΕOK. 12
13
Ͱ͖ͨɻ 14
͓ΘΓ 15
ͱ͍͏Θ͚ʹ͍͔ͳ͍ͷͰ 16
ϓϥάΠϯΛͬͯɺWordPress ΛΧ ελϚΠζ͢Δɻ 17
Action Hooks Filter Hooks 18
ΞΫγϣϯϑοΫɾϑΟϧλʔϑοΫ • WordPress ͷಈ࡞Λมߋ͢ΔͨΊͷAPI • ΞΫγϣϯϑοΫɺಈ࡞ΛՃ͢Δɻ(දࣔͨ͠ΓɺDBʹ อଘͨ͠Γ) • ϑΟϧλʔϑοΫɺΛมߋ͢Δɻ 19
ϑΟϧλʔϑοΫͷྫ function sugoi_titie( $title ) { return '͍ͧ͢͝ʔ:' . $title;
} add_filter( 'the_title', 'sugoi_titie' ); 20
21
ΞΫγϣϯϑοΫͷྫ function sptp_admin_notices() { $message = '͍ͧ͢͝ʔɻ'; printf( '<div class="notice"><p>%s</p></div>',
$message ); } add_action( 'admin_notices', 'sptp_admin_notices'); 22
23
ϑοΫͷҰཡ 2700 ݸ͘Β͍͋Δɻ • wpdocs.osdn.jp/ϓϥάΠϯ_API/ΞΫγϣϯϑοΫҰཡ • wpdocs.osdn.jp/ϓϥάΠϯ_API/ϑΟϧλʔϑοΫҰཡ • developer.wordpress.org/reference/hooks/ 24
Shortcode API 25
γϣʔτίʔυͱɻ [gallery]ɹɺͷ[]ͰғΘΕͨϞϊɻίϨΛهࣄʹهड़͢Δͱ ͦͷγϣʔτίʔυʹม͞ΕΔɻ Contact Form 7 ͷϑΥʔϜίϨΛͬͯઃஔɻ [contact-form-7 id="1" title="͓͍߹ΘͤϑΥʔϜ"]
26
function sugoi_shortcode( $atts ) { $param = shortcode_atts( array( 'count'
=> 1, ), $atts ); return str_repeat( '͍͢͝', $param['count'] ); } add_shortcode( 'sugoi', 'sugoi_shortcode' ); 27
28
29
WordCamp Kansai ϋϯζΦϯΓ·ͨ͠ɻ ʮ͜ͷهࣄ˓ͰಡΊ·͢ʯϓϥάΠ ϯΛγϣʔτίʔυͰ࡞Δɻ wckansai2016/plugin-hands-on 30
ଞʹ༷ʑͳAPI WordPress API - WordPress Codex ຊޠ൛ μογϡϘʔυΟδΣοτ API/σʔλϕʔε API/HTTP
API/ ϑΝΠϧϔομʔ API/ϑΝΠϧγεςϜAPI/ϝλσʔλ API/ Options API/ϓϥάΠϯ API/ΫΠοΫλάAPI/Rewrite API/ Settings API/γϣʔτίʔυ API/Theme Modification API/ Theme Customization API/Transients API/WordPress Ο δΣοτ API 31
WP-CLI Λ͏ͱϓϥάΠϯͷͻͳܗΛαΫοͱ ࡞ΕΔ $ wp scaffold plugin my-plugin-name 32
Plugin Handbook ެࣜͷϓϥάΠϯͷυΩϡϝϯτɻӳޠ ͚ͩͲɺίʔυͷαϯϓϧͳͲଟ͍ͷ ͰͳΜͱ͔ͳΔɻ https://developer.wordpress.org/ plugins/ 33
ͱΓ͋͑ͣ • ීஈ͍ճ͍ͯ͠ΔίʔυΛϓϥάΠϯʹ͢Δͱ͜Ζ͔Βε λʔτͯ͠ΈΑ͏ɻ • ϑοΫͱɺγϣʔτίʔυ͕͑Δ͚ͩීஈͷαΠτ੍࡞ ʹ͍ͩͿཱͭɻ 34
ͭ·͍ͮͨΒ • αϙʔτϑΥʔϥϜͰฉ͍ͯΈΔɻ • ਓͷίʔυΛಡΜͰΈΔɻ • WordBench ͱ͔Ͱฉ͍ͯΈΔɻ 35
ࢀߟॻ੶ αΠτͷ֦ுੑΛඈ༂తʹߴΊΔ WordPressϓϥάΠϯ։ൃͷόΠϒϧ 36
Thanks! Github: @torounit Twitter: @Toro_Unit Facebook: fb.me/torounit Blog: https://torounit.com 37