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
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
250
DMARC 対応の話 - MIXI CTO オフィスアワー #04
bbqallstars
1
160
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
隣接領域をBeyondするFinatextのエンジニア組織設計 / beyond-engineering-areas
stajima
1
270
強いチームと開発生産性
onk
PRO
34
11k
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
6
620
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
300
Featured
See All Featured
Code Review Best Practice
trishagee
64
17k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
For a Future-Friendly Web
brad_frost
175
9.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
How to train your dragon (web standard)
notwaldorf
88
5.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
The Invisible Side of Design
smashingmag
298
50k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
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