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
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
480
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
310
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
C++26 エラー性動作
faithandbrave
2
730
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
750
ハイテク休憩
sat
PRO
2
150
生成AIのガバナンスの全体像と現実解
fnifni
1
190
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
330
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
95
5.2k
Building Your Own Lightsaber
phodgson
103
6.1k
Automating Front-end Workflow
addyosmani
1366
200k
A better future with KSS
kneath
238
17k
Adopting Sorbet at Scale
ufuk
73
9.1k
Optimising Largest Contentful Paint
csswizardry
33
3k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Scaling GitHub
holman
458
140k
Writing Fast Ruby
sferik
628
61k
Agile that works and the tools we love
rasmusluckow
328
21k
Building Applications with DynamoDB
mza
91
6.1k
Music & Morning Musume
bryan
46
6.2k
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