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
Shinichi Nishikawa
July 10, 2016
Technology
13
4.1k
正しいテーマの作り方 これができたらテーマ制作の上級者!
WordCamp Kansai 2016 で使ったスライドです:D
Shinichi Nishikawa
July 10, 2016
Tweet
Share
More Decks by Shinichi Nishikawa
See All by Shinichi Nishikawa
Personal Projects run by WordPress
shinichin
0
1.1k
WordCamp Singapore: Offloading Calculations from WordPress onto Outer Services, such as AWS and Google.
shinichin
0
290
第一回バンコクWordPress勉強会 / WordPress Meet-up in Bangkok Vol.1
shinichin
0
800
Other Decks in Technology
See All in Technology
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
580
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
220
SSMRunbook作成の勘所_20241120
koichiotomo
3
180
組織成長を加速させるオンボーディングの取り組み
sudoakiy
3
260
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
130
Platform Engineering for Software Developers and Architects
syntasso
1
530
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
1
310
『Firebase Dynamic Links終了に備える』 FlutterアプリでのAdjust導入とDeeplink最適化
techiro
0
190
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
29
13k
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
130
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
200
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
31
6.3k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Git: the NoSQL Database
bkeepers
PRO
427
64k
The World Runs on Bad Software
bkeepers
PRO
65
11k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Navigating Team Friction
lara
183
14k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
How to train your dragon (web standard)
notwaldorf
88
5.7k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Being A Developer After 40
akosma
87
590k
Transcript
“ਖ਼͍͠” ςʔϚͷ࡞Γํ Shinichi Nishikawa WordCamp Kansai 2016 ͜Ε͕Ͱ͖ͨΒςʔϚ੍࡞ͷ্ڃऀ
“ਖ਼͍͠”ʁ
ελϯμʔυ͕͋Γɺ ཧ༝͕͋Γɺ ϝϦοτ͋Δɻ
ࠓͷ ۩ମతʹɺίʔυΛݟͳ͕ΒɺϕετϓϥΫ ςΟεΛֶͼɺࠓޙࣗͰεΩϧΛ্ͯ͠ ͍͚ΔΑ͏ʹɺϦιʔεͦͷௐํΛֶͿɻ
Shinichi Nishikawa @shinichiN
None
͜ͷ3݄·Ͱ
None
3݄͔Β
None
None
None
http://ogi.osampo-radio.com/
ϒϩά http://nskw-style.com
ӳޠ൛ http://th-daily.shinichi.me
ձࣾ http://nobil.cc
Ҡॅϒϩά & Podcast http://thai.osampo-radio.com http://journey.osampo-radio.com
WordPress ͱͷؔ
WordCamp Tokyo 2012 ࣮ߦҕһ
Bangkok WordPress Meetup ্ཱͪ͛ɻӳޠʗλΠޠάϧʔϓɺຊޠάϧʔϓ
WordBench உౡ
WordCamps
ຊͷΰʔϧ
۩ମతʹɺίʔυΛݟͳ͕ΒɺϕετϓϥΫςΟε ΛֶͼɺࠓޙࣗͰεΩϧΛ্͍͚ͯ͠ΔΑ͏ʹɺ ϦιʔεͦͷௐํΛֶͿɻ
ࡢͷςʔϚɺ ʮςʔϚ੍࡞ͷϕετϓϥΫςΟεʯ Ͱɺͦͷ݁ɺ
1. ݟͨʹప͢Δ 2. ͲΜͳϓϥάΠϯͱػೳ͢ΔͨΊͷ࡞๏ΛΔ 3. WordPress ͷػೳΛϑϧ׆༻ 4. ίϯςϯπʹ৮Βͳ͍ Ͱͨ͠ɻ
4ͭͷϕετϓϥΫςΟε http://www.slideshare.net/NSKW/ learning-from-theme-review-requirements
ͦͷଓ͖తͳҐஔ͚ͮͰ͢
େ -> খ ͷॱ൪Ͱ͍͖·͢Ͷ
WordPress ࣗମ͕ ਐԽ͍ͯ͘͠ͷΛΔ
wp_title() ΛΊΔ͜ͱʹͳͬͨ
ςʔϒϧɺ1ݸ૿͑ͨ
wordpress.org/news ָ͕
ςʔϚͷछྨ
ςʔϚͷछྨ • ςʔϚ • ࢠςʔϚ • ελʔλʔςʔϚ • _s •
ϑϨʔϜϫʔΫతͳͷ • roots.io/sage ख़ͯ͠ɺ తʹԠͯ͡ɺ ͍͚͕Ͱ͖ΔΑ͏ʹ
ͨͱ͑ɺɺ ʮ ϚϧναΠτͰࢧళϖʔδΛͨ͘͞Μ࡞Δʯͱ͍͏߹ɺ - ϕʔεʹͳΔςϯϓϨʔτςʔϚΛͰ࡞ - indexͷϖʔδΛࢠςʔϚɺࢧళͷϖʔδΛผͷࢠςʔϚ - ͋Δ͍αΠτಠཱͷςʔϚɺࢧళͷςʔϚΛઃஔ͠ɺ֤ࢧళඞཁʹ Ԡͯ͡ࢠςʔϚΛ࡞ͯࠩ͠ͷΈ࡞Δ
- ػೳશ෦ϓϥάΠϯʹམͱ͜͠ΜͰɺબతʹ༗ޮԽ
ςϯϓϨʔτ֊ ͱ get_template_parts()
ख़͠Α͏ʂ
get_template_parts() ศར
ͨͱ͑ɺ
URL ؔ࿈
ςʔϚͷURI IUUQFYBNQMFDPNXQDPOUFOUUIFNFTNZUIFNFJNHBQOH ͱ͔ XQDPOUFOUUIFNFTNZUIFNFJNHBQOH ͱ͔ॻ͔ͳ͍ɻ ҧ͏ڥ44-Խͨ࣌͠ͱ͔ࠔΔɻ
αΠτͷURL ͱ͔BCPVUͱ͔͠ͳ͍ɻ QIQCMPHJOGP lVSMz ͱ͔͠ͳ͍ɻ
<head />
underscores ͷ head ෦
ۃʹݴ͑ɺ͜ΕͰ͍͚Δ ಈతʹ͢Δ͜ͱͰɺ ͍͍͜ͱ͕͋Δɻ
͍͍͜ͱ • ͲΜͳڥͰಈ͘ • ϓϥάΠϯͱڞଘͰ͖ΔʗίϯϑϦΫτͳ͠ • ϓϥάΠϯࢠςʔϚ͔Βग़ྗΛม͑ΒΕΔ • ʢͳΜ͔ؾ͕͍͍ͪؾ͕͢Δʣ
<head /> Ͱ͓͖͍ͬͯͨ • wp_head() / wp_footer() • wp_enqueue_script /
wp_enqueue_style • wp_register_script / wp_register_style • wp_dequeue_* / wp_deregister_* • wp_add_inline_script / wp_add_inline_style
wp_head() / wp_footer() ͦΕͧΕ</head> ͷલɺ</body>ͷલʹ Կ͔Λग़ྗ͢Δࡍʹ͏ɻ
wp_head() / wp_footer() IFBEʹԿ͔Λग़ྗ͍ͤͨ࣌͞ͳͲʹɻ
wp_head() / wp_footer() ιʔεΛݟΔͱɺͨͩͷEP@BDUJPOͰ͢ɻ
wp_enqueue_script / wp_enqueue_style ͷؒ Javascript, stylesheet ΛಡΈࠐΉͱ͖ʹ͏ɻ ςʔϚͱϓϥάΠϯͷ྆ํ͔Β jQuery ͕ݺΕ
ͨ࣌ɺґଘ͢ΔεΫϦϓτ͕͋ΔࡍͳͲʹศརɻ
wp_enqueue_script / wp_enqueue_style
wp_register_script / wp_enqueue_script
wp_dequeue_script / wp_dequeue_script ࢠςʔϚϓϥάΠϯ͔Βɺ ͢Ͱʹొ͞Ε͍ͯΔ +BWBTDSJQUTUZMFTIFFUΛ আ੶͢Δ࣌ʹ͏ɻ
wp_add_inline_script / wp_add_inline_style
ίΞʹಉࠝ͞Ε͍ͯΔεΫϦϓτ K2VFSZͦͷؒɺ6OEFSTDPSFKT #BDLCPOFKTͳͲ 8PSE1SFTTʹ͡Ί͔Βೖ͍ͬͯͯɺϋϯυϧ໊ͷΈͷ ࢦఆFORVFVFͰಡΈࠐ·ΕΔɻ ͜ΕͰɺ XQJODMVEFTKTKRVFSZKRVFSZKT XQJODMVEFTKTKRVFSZKRVFSZNJHSBUFNJOKT XQJODMVEFTKTKRVFSZVJF⒎FDUNJOKT XQJODMVEFTKTKRVFSZVJF⒎FDUCMJOENJOKT
ͷ͕ͭಡΈࠐ·ΕΔɻ IUUQTEFWFMPQFSXPSEQSFTTPSHSFGFSFODFGVODUJPOTXQ@FORVFVF@TDSJQU
ηΩϡϦςΟ
ςʔϚͰؾΛ͚ͭΔ͜ͱ • ςʔϚݟͨͷ͜ͱͳͷͰɺग़ྗɻʢͭ· ΓɺԿ͔Λอଘ͠ͳ͍ʣ • ͳͷͰɺόϦσʔγϣϯͱΤεέʔϓ͕ओɻ
όϦσʔγϣϯ • ͷݕࠪͷ͜ͱ • ఆͯͨ͠ͷͱҧ͏ͷ͕དྷͯɺڍಈ͕͓͔͘͠ͳ ΔͷΛ͙ • ࣈͳΒࣈɺจࣈྻͳΒจࣈྻɺϝΞυͳΒϝ ΞυͰ͋Δ͜ͱΛ֬ೝ͢Δɻ •
ͦΕ༻ͷؔɺϗϫΠτϦετɺϒϥοΫϦετ ͳͲͷํ๏͕͋ΔͷͰݟͯΈ·͠ΐ͏
ϗϫΠτϦετʗϒϥοΫϦετ • ϗϫΠτϦετ • OKͳ܈ΛϦετ͓͍ͯͯ͠ɺೖྗʢࠓ͔Β ݕࠪ͠Α͏ͱ͍ͯ͠Δରʣ͕ɺ͜ͷϦετʹೖͬ ͍ͯΔ͔Ͳ͏͔Λ֬ೝ͢Δํ๏ • ϒϥοΫϦετ •
NGͳ܈ΛϦετ͓͍ͯͯ͠ɺೖྗ͕͜Εʹ ͋ͨΔ͔Ͳ͏͔Λ֬ೝ͢Δํ๏
ϗϫΠτϦετ
Τεέʔϓ • esc_* ؔΛ͑Δ • wp_kses() Λ֮͑Δ
esc_*()
wp_kses() • ͋Β͔͡Ίఆٛ͞Εͨ html λάͱଐੑͷΈΛ ڐՄ͠ɺͦΕҎ֎ফͯ͠ɺ҆શͳ html จࣈ ྻΛฦ͢ɻ •
ϑΟϧλϦϯάͰ͖Δɻ • a λάΛؚΊ͍͚ͨͲΤεέʔϓ͍ͨ࣌͠ͳͲ ʹศར
ԿΛΤεέʔϓ͢Δͷ͔ • ʮ֎͔Βདྷͨɺ৴པͰ͖ͳ͍શ෦ʯ ͨͱ͑ɺɺɺ • GET POST ͳͲͰૹ৴͞Ε͖ͯͨ
• σʔλϕʔε͔ΒऔΓग़ͨ͠ • RSSϑΟʔυAPIܦ༝ͳͲ֎෦αʔϏε͔ΒऔΓग़͠ ͨ
Ͳ͏Τεέʔϓ͢Δͷ͔ • ͳͥɺecho ͷதͰΤεέʔϓ͠ͳ͍ͷ͔ͱ͍ ͏ͱɺग़ྗ͞ΕΔจ຺ʹΑͬͯɺΤεέʔϓͷ ํ๏͕ҟͳͬͯ͘Δ͔Βɻ • ͳͷͰɺจ຺ʹΑͬͯطଘͷؔΛ͍͚ Δ͜ͱ͕େࣄɻ
ςϯϓϨʔτλά ͱ WordPress ͷؔ ͷҧ͍
ͨͱ͑ɺ • the_content(); ͱ echo get_the_content(); ಉ͡Ͱͳ͍ɻ • echo get_permalink();
ͱ the_permalink(); ಉ͡Ͱͳ͍
the_content() ͱ
the_content ϑΟϧλʔͱ XQJODMVEFTEFGBVMUpMUFSTQIQ
ςϯϓϨʔτλάͱͦͷଞͷؔ • ςϯϓϨʔτλάɺ͍Ζ͍ΖͱؾΛͬͯ ͘Ε͍ͯΔͷͰɺ҆৺͍͍ͯͬͯ͠ɻ the_ Ͱ͡·Δͷ • ͦ͏Ͱͳ͍ͷɺҙ͠ͳ͍ͱࢥΘ͵ڍಈ ʹͳΔ͔͠Εͳ͍ɻϑΟϧλʔΛ௨Βͳ͍ɻ ϓϥάΠϯ͔Βมߋ͕ޮ͍ͯͳ͔ͬͨΓͱ͔
͢Δɻ
ΟδΣοτɺΧελϜߘλΠϓɺΧ ελϜλΫιϊϛɺWP_*_Query ͳͲ ͷొ༻ͷίʔυδΣωϨʔλΛ͏ɻ
generatewp.com
ςʔϚ੍࡞ͷ্ڃऀͱʁ
1. ݟͨʹప͢Δ 2. ͲΜͳϓϥάΠϯͱػೳ͢ΔͨΊͷ࡞๏ΛΔ 3. WordPress ͷػೳΛϑϧ׆༻ 4. ίϯςϯπʹ৮Βͳ͍ Ͱͨ͠ɻ
ڈͷ 4ͭͷϕετϓϥΫςΟε http://www.slideshare.net/NSKW/ learning-from-theme-review-requirements
্ڃऀ • ݟͨʹప͢Δɻcss, Javascript ؤுΔɻ • WordPress తͳॻ͖ํΛΔɻ • ηΩϡϦςΟʹؾΛ͏ɻ
• δΣωϨʔλɺεχϖοτͳͲΛ׆༻͢Δɻ • ࢠςʔϚɺελʔλʔςʔϚɺϑϨʔϜϫʔΫͳͲΛ׆༻͢Δɻ • ػೳϓϥάΠϯʹৡΔɻ PHP ͷଆ໘͔ΒݟΔͱɺ ςʔϚ੍࡞ͱͯ͠Βͳ͍ͱ͍͚ͳ͍͜ͱɺ ࣮ͦΜͳʹͳ͍ɻ
͓͠·͍
Ϧιʔε • wordpress.org/news • developer.wordpress.org/themes/getting- started/ • developer.wordpress.org • ίσοΫε
ͱ codex