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
WordPress テーマ作成超入門
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
RyoUozumi
June 09, 2018
Technology
78
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WordPress テーマ作成超入門
@WordBench Nagoya 201806
RyoUozumi
June 09, 2018
More Decks by RyoUozumi
See All by RyoUozumi
ブログをスタートする人にオススメのプラグインとエディタの紹介
ryoraspp
0
130
ブロックエディター(Gutenberg)をもっと活用しよう! Aichi WordPress Meetup #5
ryoraspp
0
85
WordPress テーマ作成超入門
ryoraspp
0
180
WordPressを使う上で知っておくと 幸せ になること
ryoraspp
0
100
WordPressの関数から踏む一歩は初心者にとって大きな一歩! [WordFes Nagoya 2017 5216教室] #WordFes #WordFes03
ryoraspp
0
1.9k
大学生によるWordPress活用事例紹介 -1-大学生にこそ普及してほしいWordPress
ryoraspp
0
110
Other Decks in Technology
See All in Technology
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
なぜJMBC(Japan MCP Business Community)? MCPってどう活用できるの?
cdataj
0
110
AI時代、データエンジニアが一番おもろい
genshun9
0
460
クロスボーダーM&AのValue Upを支えるプロダクト開発。日米チームのハブになったプロダクトエンジニアの実践 / Product Engineering Conference 2026
genda
0
120
WAF 運用改善の承認サイクル/SRE_BizReach_MIXI_1
visional_engineering_and_design
2
620
「図書館」という名前のままでいいのか -Code4Lib JAPANカンファレンス2026 アンカンファレンス報告- / Code4Lib JAPAN Conference 2026: Unconference Report
ykiyota
0
170
Omarchy Quattro の日本語設定周り
simosako
2
170
AIネイティブプロダクトで顧客価値を最大化するプロダクトエンジニアとFDEの協働
righttouch
PRO
0
270
20260912_スクラムにジェネラリストは必要か
ryugen04
0
390
omasushiというライブラリを作った
polidog
PRO
0
220
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
8
690
新機種発売前に見直そう!端末移行で再ログインが要るアプリ・要らないアプリは何が違うのか 〜シームレスに再開できる設計と実装〜
zozotech
PRO
0
150
Featured
See All Featured
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
330
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
850
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Mobile First: as difficult as doing things right
swwweet
225
10k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
600
Transcript
WORDPRESS ςʔϚ࡞ೖ ڕॅྒɹ@WordBench Nagoya 201806
ࣗݾհ • ڕॅྒ • ࠓͦ͜ଔۀ͍ͨ͠௨৴ͷେੜʢӳޠΛओʹษڧதʣ • δϟζτϥϯϖοτͱΨδΣοτ͕͖ • 20138݄29ΑΓݱryo.nagoyaͰWordPressσϏϡʔ •
Twitter:@ryoraspp • Facebook: https://www.facebook.com/blog.ryoraspp/
NHKʹग़ԋͨ͜͠ͱ
ͦͦςʔϚͬͯԿʁ
צҧ͍ͯ͠͠·͏ͷ
–ίτόϯΫ(σδλϧେࣙઘͷղઆ) “ςʔϚʢʪυΠπʫThemaʣ ߦಈ࡞ͳͲͷجௐͱͳΔߟ͑ɻओɻ·ͨɺจͷɺָۂͷओટͳͲɻ ʮڞಉݚڀͷςʔϚΛܾΊΔʯʮʹͱͬͯۀࡦ͕ࠓޙͷςʔϚʹͳΔʯ ग़యɹখֶؗ ”
ͬͪ͜ͷςʔϚͱ͍͏ҙຯͰͳ ͍ʂ ύιίϯۀքͰͷςʔϚͷҙຯ
–ίτόϯΫʢύιίϯͰࠔͬͨͱ͖ʹ։͘ຊͷղઆʣ “ςʔϚ ιϑτͷഎܠϘλϯɺϑΥϯτͳͲͷσβΠϯΛ·ͱΊͯมߋ͠ɺݟͨΛม͑Δػೳͷ͜ͱͰ͢ɻʮεΩϯʯ ͱݺͿ͜ͱ͋Γ·͢ɻΟϯυζ8ͷσεΫτοϓʹʮݸਓઃఆʯʹςʔϚͷઃఆ͕͋Γ·͢ɻ ग़యɹ(ג)ே৽ฉग़൛ൃߦʮύιίϯͰࠔͬͨͱ͖ʹ։͘ຊʯύιίϯͰࠔͬͨͱ͖ʹ։͘ຊʹ͍ͭͯɹใ ”
ͭ·ΓWORDPRESͷ ςʔϚ ݟͨΛม͑ΔػೳͰ͢ʂ
ςϯϓϨʔτ֊
https://wpdocs.osdn.jp/wiki/images/wp-template-hierarchy.jpg
HTMLͷ߹ <header> <body> <footer> style.css
ςʔϚͷ߹ header.php single.php footer.php style.css sidebar.php index.php page.php front-page.php archive.php
404.php functions.php
• index.php ͷςϯϓϨʔτϑΝΠϧ • archive.php ΞʔΧΠϒϖʔδΛදࣔ͢ΔςϯϓϨʔτϑΝΠϧ • single.php ݸผߘϖʔδΛදࣔ͢ΔςϯϓϨʔτϑΝΠϧ •
page.php ݻఆϖʔδΛදࣔ͢ΔςϯϓϨʔτϑΝΠϧ • front-page.php αΠτϑϩϯτϖʔδΛදࣔ͢ΔςϯϓϨʔτϑΝΠϧ • sidebar.php αΠυόʔΛදࣔ͢ΔςϯϓϨʔτϑΝΠϧ • header.php <?php get_header(); ?> ͷத • footer.php <?php get_footer(); ?> ͷத • functions.php ςʔϚͷػೳʢϓϥάΠϯͱಉ͜͡ͱ͕Ͱ͖Δʣ
͜͜Ͱ͜Μͳ͜ͱ͕ٙੜ·Ε·͢
ςϯϓϨʔτϑΝΠϧʹ ػೳ͔͚Δ functions.phpʹ ϓϥάΠϯʹ
ͱ͍͏͜ͱʂ
ςϯϓϨʔτϑΝΠϧʹػೳΛ͔͖͍ͨؾ࣋ͪ ͱ functions.phpʹػೳΛ͔͖͔͍ͨؾ࣋ͪ ͱ ϓϥάΠϯʹػೳΛॻ͖͍ͨؾ࣋ͪ ͕ ಉ࣌ʹ༙͖ىͬͯ͜͠·͏
ରॲ๏ • ςϯϓϨʔτϑΝΠϧʹςϯϓϨʔτλά Λओʹ • functions.phpʹςʔϚͷػೳΛ͔͘ • ϓϥάΠϯʹςʔϚʹؔ͢ΔҎ֎ͷ͜ͱΛ͔ ͘
͔͠͠ॳ৺ऀʹHOOKSͱ͍͏ٕज़Λ͏ͷ ͍͠ͷͰɺجૅతͳςΫχοΫΛʹ͚ͭΔ· ͰςʔϚςʔϚͷͨΊͷؔʢςϯϓϨʔτ λάʣΛ͔͘Α͏զຫ͠·͠ΐ͏ɻ
ςʔϚΛ࡞͍ͬͯ͜͏ʂ
ςʔϚΛ࡞͢Δલʹ • WordPressͷσόοάϞʔυΛ༗ޮԽ • ϓϥάΠϯʢShow Current Template ຢWP Extend ToolbarʣΛΠϯετʔϧ+༗ޮԽ
• ςʔϚϢχοτςετͷΠϯϙʔτ • style.cssͷίϝϯτʹςʔϚʹؔ͢Δ༰Λهड़
STYLE.CSSΛॻ͍ͯΈΑ͏ /* Theme Name: ςʔϚͷ໊લ Theme URI: ςʔϚͷαΠτ Description: ςʔϚͷઆ໌
Version: 0.1 όʔδϣϯ1ʹͯ͠(ͤͯ͞)ެ։͠Α͏ʂ Author: WBN ࣗͷ໊લΛΒ͠ΊΕΔ Author URI: ࣗͷαΠτ License: GNU General Public License v2 or later */ •
ςʔϚΛ࡞͢Δલʹ php get_header(); ?> header.phpΛಡΈࠐΉ php get_sidebar(); ?> sidebar.phpΛಡΈࠐΉ php
get_footer(); ?> footer.phpΛಡΈࠐΉ
Τεέʔϓॲཧ • Τεέʔϓॲཧͷඞཁੑ • ͠URLʹ༗ͳϦϯΫΛೖྗ͞ΕͯɺແԽͰ͖ɺXSSΛࢭͰ͖Δ • <?php echo esc_url( home_url(
'/' ) ); ?> • ྫ:<script>ѱ͍.js</script> • ݕࡧཝίϝϯτཝʹ͔͔Εͯ • <script>ѱ͍.js</script> • ͱͳΓѱ͍Javascript͕ແޮԽ͞ΕΔ •
HEADER.PHPΛॻ͍ͯΈΑ͏ • <!DOCTYPE html> • <html <?php language_attributes(); ?> •
<head> • <meta charset="<?php bloginfo( 'charset' ); ?>”> • <?php wp_head(); ?> • </head>
NAVIGATION • wp_nav_menuʢʣΛ༻͢Δ • ԼهΛfunctions.phpʹ͔͘ • register_nav_menus( array( • 'menu-1'
=> esc_html__( 'Primary', 'wbn' ), • ) );
FOOTER.PHPΛॻ͍ͯΈΑ͏ • Copyright(ஶ࡞ݖදࣔʣ • <?php wp_footer() ?> • </body> •
</html>
SINGLE.PHPΛॻ͍ͯΈΑ͏ • while ( have_posts() ) : • the_post(); •
the_post_navigation(); • comments_template();
SIDEBAR.PHPΛॻ͍ͯΈΑ͏ • <aside id="secondary" class="widget-area"> • <?php dynamic_sidebar( 'sidebar-1' );
? > • </aside>
FUNCTIONS.PHP • add_theme_support( 'title-tag' ); • λΠτϧλάΛՃͯ͘͠ΕΔ • add_theme_support( 'post-thumbnails'
); • ΞΠΩϟονը૾Λొ
FUNTIODNS.PHP 2 • CSSjsͳͲΛfunctions.phpͰཧ͍ͨ͠߹ • function wbn_scripts() { • wp_enqueue_style(
'wbn-style', get_stylesheet_uri() ); • wp_enqueue_script( 'wbn-navigation', get_template_directory_uri() . '/js/ navigation.js', array(), '20151215', true ); • wp_enqueue_script( 'wbn-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
FUNCTIONS.PHP 3 • ઌ΄Ͳ࡞ͬͨαΠυόʔΛfuntions.phpʹొ • function wbn_widgets_init() { • register_sidebar(
array( • 'name' => esc_html__( 'Sidebar', 'wbn' ), • 'id' => 'sidebar-1', • 'description' => esc_html__( 'Add widgets here.', 'wbn' ), • 'before_widget' => '<section id="%1$s" class="widget %2$s">', • 'after_widget' => '</section>', • 'before_title' => '<h2 class="widget-title">', • 'after_title' => '</h2>', • ) );
॓ɿ͜ͷςϯϓϨʔτΛ ͔͍ͯΈΑ͏ • page.phpʢݻఆϖʔδΛදࣔ͢ΔςϯϓϨʔτʣ • singular.php(page.phpͱsingle.php͕ແ͍ࡍʹಡΈࠐ·ΕΔ (4.3લindex.php͕ಡΈࠐ· Εͯͨ)) • index.php
• archive.php • category.php • author.php <?php get_template_part( ‘template/page’); ?> ʮςϯϓϨʔτ ύʔπʯͰݕࡧ
THEME CHECK WordPress.org ͰఆΊΒΕ͍ͯΔςʔϚͷ࣭ ʹؔ͢ΔΨΠυϥΠϯʯΛຬ͍ͨͯ͠Δ͔Λ νΣοΫͰ͖ΔϓϥάΠϯ
None
͝ਗ਼ௌ͋Γ͕ͱ͏ ͍͟͝·ͨ͠ʂ
͜ͷεϥΠυॳ৺ऀ͚ʹ࡞ͬͨͷͰͳ͘ɺ ॳ৺ऀ͕࡞ͬͨͷͳͷͰؒҧͬͯͨΓɺͨ͠ Β͝ࢦఠ͍ͩ͘͞ ΑΖ͓͘͠ئ͍͠·͢ɻ