Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
プラグインやっちまった小咄集
Search
Toro_Unit (Hiroshi Urabe)
March 24, 2017
Programming
4.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
プラグインやっちまった小咄集
WordBench東京 3月勉強会「WordPress プラグイン祭り」での登壇資料です。
Toro_Unit (Hiroshi Urabe)
March 24, 2017
More Decks by Toro_Unit (Hiroshi Urabe)
See All by Toro_Unit (Hiroshi Urabe)
WordPress のサイト制作について改めて考える Toro_Unit / 2026.07.25 @ Shinshu WordPress Meetup
torounit
0
220
ブロックテーマ、WordPress でウェブサイトをつくるということ / 2026.02.07 Gifu WordPress Meetup
torounit
0
860
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
910
ブロックテーマとこれからの WordPress サイト制作 / nishinomiya.dev@2025-12-21
torounit
1
310
ブロックテーマとこれからの WordPress サイト制作 / Toyama WordPress Meetup Vol.81
torounit
0
840
ブロックテーマ時代における、テーマの CSS について考える Toro_Unit / 2025.09.13 @ Shinshu WordPress Meetup
torounit
0
970
ブロックテーマでサイトリニューアルした話 / Toro_Unit / 2025.04.12 @ Shinshu WordPress Meetup
torounit
1
380
Cloudflare Meetup Nagano Vol.3
torounit
1
190
僕が考える 「HTML サイトを WordPress にする」話 / 2023-11-05 Kansai WordPress Meetup
torounit
9
9k
Other Decks in Programming
See All in Programming
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.7k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
620
ChromeでローカルLLM
ryu1013
0
140
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
contenteditable と日本語入力に向き合う
colorful12
0
200
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
570
Odyssey Design
rkendrick25
PRO
2
880
The Pragmatic Product Professional
lauravandoore
37
7.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
We Have a Design System, Now What?
morganepeng
55
8.4k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
The Curse of the Amulet
leimatthew05
3
16k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
Producing Creativity
orderedlist
PRO
348
41k
Mind Mapping
helmedeiros
1
400
Transcript
ϓϥάΠϯͬͪ·ͬͨখᄉू ຊʹ͋ͬͨϓϥάΠϯͷڪ͍ Toro_Unit / 2017.03.24 @WordBench Tokyo. 1
ࢠᐌɺաࣕෆվɺੋҦաᛘ "ࢠᐌ͘ɺաͪͯվΊ͟ΔɺੋΛաͱҦ͏ɻ" ʰޠʱӴྶެ29 2
$ whoami ͜͡͠ΐ͏͔͍ 3
Toro_Unit ෦ ߛ (͏Β ͻΖ͠) 28͍͞ʹͳΓ·ͨ͠ ϑϦʔϥϯε Frontend Engineer /
Plugin Developer / Web Designer WordBench Nagano Moderator Github: @torounit Twitter: @Toro_Unit Facebook: fb.me/torounit Blog: https://torounit.com 4
ݝদຊࢢ͔Β͖·ͨ͠ɻ1 • WordBenchʹͥͻͲ͏ͧɻ • ࣍ճ 5/13ʢʣͰ͢ʂ • ొஃऀืूதͰ͢ʂ 1 https://commons.wikimedia.org/wiki/File:
130608_Matsumoto_Castle_Matsumoto_Nagano_pref_Japan02bs4.jpg Author: 663highland. License: CC BY 2.5 5
6
Plugins • Custom Post Type Permalinks • Simple Post Type
Permalinks • Responsive Slide • Other... Theme • Vanilla 7
8
WordCamp Kyoto 2017 • 2017.06.24 ~ 25 • ژେֶ ࠃࡍՊֶΠϊϕʔγϣϯ౩
9
Ξοϓσʔτͨ͠Βന͍ը໘ʹͳͬͨ ใࠂ͕͍ͬͺ͍དྷͨࣄ݅ɻ @Custom Post Type Permalinks 1.5.1 10
• ͋ΔͷਂϓϥάΠϯͷΞοϓσʔτΛߦ͏ɻ ͦͯ͠ཌேɾɾɾ 11
12
Why!!!!???? 13
• Travis CI Λར༻ͯ͠ɺPHPUnit ΛΒ͍ͤͯͨΓɺPHPͷจ ๏νΣοΧʔΛΒ͍ͤͯΔɻ • σϓϩΠΛࣗಈԽ͍ͯ͠ΔͷͰɺςετʹ߹֨͠ͳ͍ͱσϓ ϩΠग़དྷͳ͍Α͏ʹͳ͍ͬͯͨɻ 14
Why!!!!???? 15
ݪҼɻ 16
17
18
19
• PHPͷจ๏తʹɺOKɻ • खݩͷ։ൃڥͰಛʹແ͍ɻ • PHPUnit ͰΤϥʔʹͳΒͳ͍ͷͰɺݕग़Ͱ͖ͳ͔ͬͨɻ 20
༷ʑͳϨΠϠʔͰςετΛߦ͏͜ͱେࣄɻ • LintϚδେࣄɻ • PHPUnitᘳͰͳ͍͠ɺ༷ʑͳϨΠϠʔͰςετΛߦ͏ ͜ͱେࣄɻ • PHP_CodeSniffer and WordPress-Coding-Standards
ΛͱΓ ͋͑ͣೖΕΑ͏ɻ • ໘Ͱશ෦ରԠ͠Α͏ɻษڧʹͳΔࣄ݁ߏ͓͓͍Αɻ 21
@see όάΛͲͷΑ͏ʹݟ͚ͭΔ͔ // Speaker Deck 22
ͦͷ΄͔ͬͪ·ͬͨूɻ 23
҆қʹཁΛ΄͍΄͍࣮ 24
ʮ͜Μͳػೳ΄͍͠Ͱ͢ʂʯΛ҆қʹड͚ೖΕΔͱͭΒ͍ʂ 25
• ͕ࣗେͯ͠Θͳ͍ػೳͩͱݕূ͕͍͠ɻ • ʢͦͦԿΛݕূ͖͢ʁʣ • ຊʹదͳઃܭɾ࣮͕͍͠ɻ • ͳͷͰɺΒ͔͢έʔε͕ଟ͍ɻ • ޙʑ͍Ζ͍Ζෛ୲ʹͳΔ
26
͕ࣗओମతʹऔΓΊΔ͔Ͳ͏͔ʁ࣭Λอ্ͭͰେɻ • ͦΕΛ࣮͢ΔͷͰ͋Εɺ͕ࣗඞཁͩͱࢥ্ͬͨͰɻ • ཁΛग़͖ͯͨ͠ਓר͖ࠐΉͷେ͔ɻ 27
get_option( 'key' , default ); 28
͜ͷσϑΥϧτΛม͑ͨ͘ͳͬͨɻʢtrue -> falseʣ ͔͠͠ɺ ֘ͷ Option ͕ଘࡏ͍ͯ͠ͳ͍߹ɺΞοϓσʔτ Ͱڍಈ͕มΘͬͯ͠·͏ɻ ໓ۤࠔͬͨɻ 29
σϑΥϧτͷOptionΛget_optionͰߦ͏ͷෆຯ͍ɻ ͦͦऔಘ࣌ʹ͢Δ͜ͱʁ 30
add_option() Λ༻͍ͯɺDBʹอଘ͢͠ɻ 31
register_activation Ͱͷಈ࡞ڥͷݕূ 32
• ଠޑͰ༗໊ͳਓ੍͕࡞ͨ͠ϓϥάΠϯͰى͖ͨ൵ܶɻ • PHPͷόʔδϣϯ͕5.6ະຬͷڥͰɺϓϥάΠϯ͕ಈ࡞͠ ͳ͍Α͏ʹมߋ͞Ε͍ͯͨɻ • register_activation Ͱ༗ޮԽͰ͖ͳ͍Α͏ʹͳ͍ͬͯͨͷ Ͱɺແͦ͞͏͕ͩɾɾɾɾ 33
• ߋ৽࣌ʹɺregister_activation ൃՐ͠ͳ͍!!! • ͪͳΈʹੲ(3.1ະຬ)ͷ͜ΖൃՐ͍ͯͨ͠Β͍͠ɻ #14915 • PHP5.5ҎԼͷڥͰߋ৽ͨ͠߹ɺ༗ޮʹͳͬͨ··!!! 34
• register_activation ͚ͩͰෆेɻґଘ͢ΔϓϥάΠϯ͕ ͋Δ߹ɺͦΕ͕ఀࢭͨ͠߹ͳͲ͋Δɻ • admin_notices ͰɺΤϥʔৗʹදࣔ͢͠ɻ 35
ͦͦΞοϓσʔτͷݕग़ͭΒ͍ɻ 36
• WordPress ʹɺϓϥάΠϯͷΞοϓσʔτΛݕ͢ΔAPI ͕ಛʹଘࡏ͠ͳ͍ɻ • register_update_hook ఏҊ͞Ε͕ͨɺ࣮͞Εͳ͔ͬ ͨɻ#14912 • ϓϥάΠϯ࡞Δͱ͖ɺϓϥάΠϯͷόʔδϣϯΛ
Option ʹಥͬࠐΜͰ͓͘ͱʹཱͭ͜ͱ͋Δ͔͠Εͳ͍ɻ 37
Singleton ਏ͍ɻ 38
• WP-CLIͰϓϥάΠϯͷͻͳܗΛੜ͍ͯ͠Δ߹ɺϓϥά ΠϯͷϝΠϯͷϑΝΠϧࣗಈతʹinclude͞ΕΔɻ • ϓϥάΠϯ͕࣮ߦ͞Εͨঢ়ଶͰςετ͕͡·Δʂ • ςετ͕ͻ͡ΐʔʹ໘ͳίτʹͳΔɻ 39
ͦͷ Singleton ຊʹඞཁʁ ඞཁͳέʔε͋Δʹ͋Δͣɻ 40
• ͦͦɺϓϥάΠϯͷClassΛϢʔβʔ͕উखʹ͏Α͏ ͳέʔεΛఆ͢Δͷແҙຯɻ • ϢʔβʔαΠυͰɺϓϥάΠϯͷΠϯελϯεΛ৮Β͍ͤͨ Α͏ͳ߹ɺ૭ޱʹͳΔClassͱ͔Λ࡞ͬͨํ͕ྑ͍ɻ • ϢʔβʔଆͰ͜ͷϓϥάΠϯΛΧελϚΠζग़དྷΔΑ͏ʹ… ͬͯͷͦΕͦ͜ɺཁ͕དྷͨΒߟ͑Δ͜ͱɻ 41
Others • plugin_basename Λ͏ͱςετͰࠔΔ͜ͱ͕༗ͬͨΓ͢ Δɻʢςετ࣌ͷWordPressͷwp-contentͷதʹϓϥάΠϯ ͕ଘࡏ͍ͯ͠ͳ͍ͨΊʣ • ϓϥάΠϯҙ֎ʹ࡞Γखͱ͓͖ͯ͠߹͍͕ൃੜ͢Δͷ Ͱɺςετେࣄɻ͕ؔඇਪʹͳͬͨΓͷཧ༝Ͱॻ͖ ͑ΔࡍͳͲҙਤͤ͵όά͕ࠞೖ͢ΔՄೳੑɻ
• ҆қͳ༷มߋɺେࣄΩέϯɻ 42
͠ΜͲ͍ʂ 43
͚Ͳ... ֶͼଟ͍ɻ 44
• ϓϧϦΫΤετ, issue, ποίϛͳͲͰษڧʹͳΔࣄଟ͍ɻ • ʮςετͱ͔Ͳ͏ͯ͠ྑ͍͔ղΒͳ͍Ͱ͎͢ʢʼʻʣʯͱ͔ ݴ͏ͱɺϓϧϦΫ͕དྷͨΓɺϒϩάͷωλʹ͞ΕͨΓ͢Δɻ ϦϦʔε͠ͳ͍ͱɺϚαΧϦ͢ΒඈΜͰ͜ͳ͍ɻ 45
ࣗͰମݧͯͦ͜͠! 46
Let's Release Your Plugin!!! 47
Thanks! Github: @torounit Twitter: @Toro_Unit Facebook: fb.me/torounit Blog: https://torounit.com 48