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
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
7
400
Lambdaと地方とコミュニティ
miu_crescent
1
180
TinyGoを使ったVSCode拡張機能実装
askua
2
200
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
28k
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
1
390
徹底比較!HA Kubernetes ClusterにおけるControl Plane LoadBalancerの選択肢
logica0419
2
140
Microsoft Intune アプリのトラブルシューティング
sophiakunii
1
400
Engineering at LY Corporation
lycorp_recruit_jp
0
290
신뢰할 수 있는 AI 검색 엔진을 만들기 위한 Liner의 여정
huffon
0
540
OCI Data Integration技術情報 / ocidi_technical_jp
oracle4engineer
PRO
1
2.6k
AWS パートナー企業でテクニカルサポートに従事して 3年経ったので思うところをまとめてみた
kazzpapa3
1
220
メールサーバ管理者のみ知る話
hinono
1
100
Featured
See All Featured
Speed Design
sergeychernyshev
24
600
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Typedesign – Prime Four
hannesfritz
40
2.4k
Done Done
chrislema
181
16k
How to train your dragon (web standard)
notwaldorf
88
5.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The World Runs on Bad Software
bkeepers
PRO
65
11k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
What's in a price? How to price your products and services
michaelherold
243
12k
Docker and Python
trallard
40
3.1k
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