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
RyoUozumi
June 09, 2018
Technology
82
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
Technical Project Manager の役割とやりがい、少しだけ AI
yoshiiryo1
0
590
Deep Data Security 機能解説
oracle4engineer
PRO
3
1k
AIエージェントの監視、思考を見るか行動を見るか / Monitoring AI Agents: Thoughts or Actions
yusukeshimizu
1
140
Don't write the architecture only in the prompt.
neohsu
0
310
令和の今、あらためて IAM を考える。アクセスキーを「無くせない現実」との向き合い方
kazzpapa3
0
140
Sizing, Benchmarking and Performance Tuning Apache Flink Clusters
rmetzger
0
100
Strands Decider 2BでAWSアップデートの目利きをしてみた
sato4mi
1
110
WireGuard for Apache NuttX - Bringing Secure Remote Access to embedded Devices -
aki310ooooo
0
150
Consistency for mere mortals - A gentle guide to consistency
ufried
0
120
Lint の層を組み直した話
bengo4com
3
310
複雑な業務システムを高速でつくるため、チーム全員をつくれる人へ
ayakurabuchi
0
130
視野はAIに、視座は人に / ai-for-breadth-humans-for-perspective
nkzn
6
3k
Featured
See All Featured
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
810
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
740
Done Done
chrislema
187
17k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
550
Darren the Foodie - Storyboard
khoart
PRO
4
4.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
460
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
520
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.7k
Claude Code のすすめ
schroneko
67
230k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
570
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
590
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
͝ਗ਼ௌ͋Γ͕ͱ͏ ͍͟͝·ͨ͠ʂ
͜ͷεϥΠυॳ৺ऀ͚ʹ࡞ͬͨͷͰͳ͘ɺ ॳ৺ऀ͕࡞ͬͨͷͳͷͰؒҧͬͯͨΓɺͨ͠ Β͝ࢦఠ͍ͩ͘͞ ΑΖ͓͘͠ئ͍͠·͢ɻ