Slide 1

Slide 1 text

WordPress ςʔϚ࡞੒࠶ೖ໳ Toro_Unit / 2017.05.20 @ WBNagano vol.9 1

Slide 2

Slide 2 text

Toro_Unit ઎෦ ߛ (͏Β΂ ͻΖ͠) • দຊࢢࡏॅ 10೥໨ • ϑϦʔϥϯε • Frontend Engineer / Plugin Developer / Web Designer • WordBench ௕໺ ϞσϨʔλʔ Github: @torounit Twitter: @Toro_Unit Facebook: fb.me/torounit Blog: https://torounit.com 2

Slide 3

Slide 3 text

Plugins Developer • Custom Post Type Permalinks • Active install: 80,000 + • Downloads: 380,000 + • Simple Post Type Permalinks • Powerful Posts Per Page • Responsive Slide • etc... 3

Slide 4

Slide 4 text

Theme Developer Vanilla 4

Slide 5

Slide 5 text

Other Contribution • 4.3 ~ 4.5, 4.7 ίΞߩݙऀ • WordCamp Kansai 2016 / Tokyo 2016 ࣮ߦҕһ • WordCamp Kansai 2017 ηογϣϯνʔϜ Ϧʔμʔ • Speaker • WordCamp Kansai 2015, 2016 / Tokyo 2015, 2016 • WordBench Tokyo • WordBench Osaka • etc... 5

Slide 6

Slide 6 text

ςʔϚ࡞ͬͨ͜ͱ͋Δਓ! 6

Slide 7

Slide 7 text

WordPressͷਪ঑͍ͯ͠ΔςʔϚͷ࡞ ΓํΛ஌ͬͯΔਓ! 7

Slide 8

Slide 8 text

ʮผʹಈ͍ͯΔ͔Βྑ͘ͳ͍ʁʯ 8

Slide 9

Slide 9 text

ʮ͸͍ʁ(Җѹ)ʯ 9

Slide 10

Slide 10 text

ਪ঑͞Εͳ͍࡞ΓํΛ͍ͯ͠Δͱɾɾɾ • ϓϥάΠϯ͕ͳΜ͔มͳಈ͖͢Δɾɾɾɻ • ຊͷ௨Γʹ࡞ͬͨͷʹ͏͔͝ͳ͍ɾɾɾɻ • ϦχϡʔΞϧΊͪΌͪ͘Ό͍ͨ΁Μɾɾɾɻ • ηΩϡϦςΟϗʔϧʹͳͬͨΓɾɾɾɻ 10

Slide 11

Slide 11 text

͋ΔϓϥάΠϯ࡞ऀͷ੠ 11

Slide 12

Slide 12 text

ඇਪ঑ͷ࡞Γํͯ͠ΔςʔϚͰͷςετ͸ɺͯ͠ͳ͍͠ɺͰ͖ ͳ͍͠ɺ͢Δؾ΋ͳ͍ɻ ͍ͬͯ͏͔Ͳ͏΍ͬͯςετ͢Ε͹͍͍ͷΑʁ 12

Slide 13

Slide 13 text

ʮΑ͘஌Βͳ͍͚ͲɺͱΓ͋͑ͣಈ͍ͯΔ͔Βɾɾɾʯ ΄ΜͱʹͦΕͰେৎ෉ʁ 13

Slide 14

Slide 14 text

ςʔϚͷ࡞ΓํΛ͓͞Β͍ɻ 14

Slide 15

Slide 15 text

1. ςϯϓϨʔτͷछྨ 15

Slide 16

Slide 16 text

σϑΥϧτςʔϚ Twenty Seventeen ΛݟͯΈΑ͏ɻ 16

Slide 17

Slide 17 text

͙͑ͬ 17

Slide 18

Slide 18 text

େৎ෉ɻ 18

Slide 19

Slide 19 text

ςʔϚͷ࠷খߏ੒ • index.php • style.css ͜Ε͚ͩʂ 19

Slide 20

Slide 20 text

͡Ό͊ͳΜͰ͋Μͳʹɾɾɾ 20

Slide 21

Slide 21 text

ͱ͍͏Θ͚ͰςϯϓϨʔτͷ࢓૊ΈΛ͓͞Β͍͠·͠ΐ͏ɻ 21

Slide 22

Slide 22 text

1-1 ςϯϓϨʔτ֊૚ 22

Slide 23

Slide 23 text

ςϯϓϨʔτ֊૚ͱ͸ʁ WordPressͷςϯϓϨʔτ͕બ୒͞ΕΔ࢓૊Έɻ ݱࡏදࣔ͞Ε͍ͯΔϖʔδͷঢ়ଶʹ߹ΘͤͯςϯϓϨʔτ͕ݕ ࡧ͞ΕΔɻ 23

Slide 24

Slide 24 text

24

Slide 25

Slide 25 text

ྫ1 ΧςΰϦʔ ID:2, εϥοά: news ͷ৔߹ɻ 1. category-news.php 2. category-2.php 3. category.php 4. archive.php 5. index.php ͷॱʹςϯϓϨʔτ͕ݕࡧ͞Εɺݟ͔ͭͬͨ΋ͷ͕ద༻͞ΕΔɻ 25

Slide 26

Slide 26 text

ྫ2 ϒϩά౤ߘͷ৔߹ɻ 1. single-post.php 2. single.php 3. singular.php 4. index.php ͷॱʹςϯϓϨʔτ͕ݕࡧ͞Εɺݟ͔ͭͬͨ΋ͷ͕ద༻͞Ε Δɻ 26

Slide 27

Slide 27 text

ৄ͘͠͸ɺςϯϓϨʔτ֊૚ - WordPress Codex ೔ຊޠ ൛ WordPress Codex: WordPress ͷΦϯϥΠϯ υΩϡϝϯτɺWiki. 27

Slide 28

Slide 28 text

1-2 ςϯϓϨʔτϞδϡʔϧ 28

Slide 29

Slide 29 text

ڞ௨෦෼ΛผͷςϯϓϨʔτʹग़དྷΔɻ • header.php : get_header() • footer.php : get_footer() • sidebar.php :get_sidebar() • searchform.php : get_search_form() • comments.php : comments_template() 29

Slide 30

Slide 30 text

get_template_part() ΦϦδφϧͷςϯϓϨʔτΛݺͼग़͢ɻ ྫ • get_template_part('template-parts/hoge'); template-parts/hoge.php Λݺͼग़͢ɻ • get_template_part('template-parts/hoge', 'piyo'); template-parts/hoge-piyo.php Λݺͼग़͢ɻ 30

Slide 31

Slide 31 text

๻ͷ࠷খߏ੒ • index.php • single.php • page.php • header.php • footer.php ͔͜͜Βద֦ٓு͍ͯ͘͠ɻ 31

Slide 32

Slide 32 text

2. CSS ͱ JS ͷಡΈࠐΈ 32

Slide 33

Slide 33 text

Α͋͘Δτϥϒϧ • ʮͳΜ͔jQuery͕2ճݺͼग़͞ΕͯΔɾɾɾɾʯ 33

Slide 34

Slide 34 text

͜͏ͯ͠·ͤΜʁ • wphead, wpfooter ςʔϚʹ͸ඞͣೖΕΔౕɻ 34

Slide 35

Slide 35 text

ਪ঑͞ΕΔ΍Γํ header.php footer.php

Slide 36

Slide 36 text

functions.php function my_enqueue_scripts() { //include css wp_enqueue_style( 'my-style', get_stylesheet_uri() ); wp_enqueue_style( 'my-common', get_template_directory_uri() . '/common.css', array( 'my-style' ), '1.0.0' ); //include js wp_enqueue_script( 'my-scripts', get_template_directory_uri() . '/scripts.js', array( 'jquery' ), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts' ); 36

Slide 37

Slide 37 text

wp_enqueue_style ΍ɺwp_enqueue_script Λ࢖͏ͱ WordPress͕ྑ͍ײ͡ʹ CSS Λ JS ಡΈࠐΜͰ͘ΕΔɻ jQuery, underscore, Backbone.js, masonry ౳͸WordPress ʹ಺ଂ͞Ε͍ͯΔɻ ؔ਺ϦϑΝϨϯε/wp enqueue script - WordPress Codex ೔ຊޠ൛ 37

Slide 38

Slide 38 text

3. σʔλͷແ֐Խ αχλΠζ / Τεέʔϓ 38

Slide 39

Slide 39 text

͋Γ͕ͪͳϠόΠίʔυ

39

Slide 40

Slide 40 text

΋͠ΧελϜϑΟʔϧυʹෆਖ਼ͳσʔλ͕ೖͬͯΔͱ... ྫ͑͹ɺ">͜Μʹͪ͸͜Μʹͪ͸!! Έ͍ͨͳจࣈྻɻ

͜Μʹͪ͸͜Μʹͪ͸!!">

40

Slide 41

Slide 41 text

41

Slide 42

Slide 42 text

΍͹͍ʂ 42

Slide 43

Slide 43 text

ݟͨ໨͕յΕΔ͚ͩͳΒ·ͩ͠΋ෆਖ਼ͳJSͱ͔ΛຒΊࠐ·ΕΔ ڪΕ΋.... • Ϣʔβʔ͕มͳίʔυΛίϐϖͨ͠৔߹ɻ • WordPressͷύεϫʔυ͕ྲྀग़৔߹ɻ • etc... ͍ΘΏΔ XSSͷ੬ऑੑ 43

Slide 44

Slide 44 text

ਖ਼͘͠σʔλͷແ֐ԽΛ͠Α͏ɻ
ෆਖ਼ͳσʔλ͕ೖͬͯ΋େৎ෉ɻ

44

Slide 45

Slide 45 text

WordPressʹ༻ҙ͞Ε͍ͯΔαχλΠζͷؔ਺ • esc_html: ௨ৗͷςΩετ • esc_attr: HTMLଐੑ • esc_url: URL/ϝʔϧΞυϨεͳͲ • esc_textarea: textareaཁૉ • esc_js: ΠϯϥΠϯJS • wp_kses: ಛఆͷHTMLλάΛڐՄ͢Δ৔߹ 45

Slide 46

Slide 46 text

4. ϓϥάΠϯςϦτϦʔ 46

Slide 47

Slide 47 text

• ΞΫηεղੳ • ޿ࠂίʔυ • γΣΞϘλϯ • ΧελϜ౤ߘλΠϓ/λΫιϊϛʔ • SEOपΓͷ͍Ζ͍Ζɾɾɾ 47

Slide 48

Slide 48 text

αΠτΛϦχϡʔΞϧͨ͠Β͖͑ͨ!!! 48

Slide 49

Slide 49 text

·͍ͣʂ 49

Slide 50

Slide 50 text

ςʔϚΛม͑Δͱ͍Ζ͍Ζಈ͔ͳ͘ͳΔ… 50

Slide 51

Slide 51 text

·͍ͣ!!! 51

Slide 52

Slide 52 text

ςʔϚςϦτϦʔ WEBαΠτͷݟͨ໨ɻ ϓϥάΠϯςϦτϦʔ WEBαΠτͷػೳɻ -> ػೳ͸ϓϥάΠϯͰʂ 52

Slide 53

Slide 53 text

ϓϥάΠϯͷ࡞Γํɾɾɾʁ • wckansai2016/plugin-hands-on 53

Slide 54

Slide 54 text

ϊϯϓϩάϥϚʔͷͨΊͷWordPressϓϥάΠϯ࡞੒௒ೖ໳ https://www.slideshare.net/mignonstyle/make-wordpress-plugin 54

Slide 55

Slide 55 text

αΠτͷ֦ுੑΛඈ༂తʹߴ ΊΔ WordPressϓϥάΠϯ ։ൃͷόΠϒϧ 55

Slide 56

Slide 56 text

5. ςʔϚͷݕূ 56

Slide 57

Slide 57 text

ςʔϚνΣοΫϓϥάΠϯ Theme Check — WordPress Plugins 57

Slide 58

Slide 58 text

58

Slide 59

Slide 59 text

ߦّͷѱ͍ςʔϚ 59

Slide 60

Slide 60 text

60

Slide 61

Slide 61 text

ͪͳΈʹ • WordPressͷ؅ཧը໘͔Βμ΢ϯϩʔυͰ͖ΔςʔϚ (ެࣜσ ΟϨΫτϦ ܝࡌςʔϚ)͸શͯ͜ͷςετ͕௨ͬͯΔɻ • ྑ͘ղΒͳ͍ςʔϚΛ࢖͏͘Β͍ͳΒɺެࣜσΟϨΫτϦ͔ ΒςʔϚΛ୳ͦ͏ɻ 61

Slide 62

Slide 62 text

6.υΩϡϝϯτ 62

Slide 63

Slide 63 text

Theme Developer Handbook • ӳޠ͚ͩͲͦ͜·Ͱ೉͜͠ͱ͸ॻ͍ ͯͳ͍ͷͰҙ֎ʹಡΊΔɻ 63

Slide 64

Slide 64 text

WordPress Codex ೔ຊޠ൛ • ςϯϓϨʔτλάͷ࢓༷ͳͲ͸͜͜ Ͱ֬ೝɻ 64

Slide 65

Slide 65 text

_s • WordPress.com ͷӡӦݩͷ Automattic ͕։ൃ͍ͯ͠Δϕʔες ʔϚɻ͜ΕΛϕʔεʹCSSΛ௥Ճɺ HTMLΛฤूͯ͠ςʔϚΛ࡞Δͱ͍͏ ํ๏΋͋Δɻ 65

Slide 66

Slide 66 text

τϥϒϧ͕ى͖Δલʹਖ਼͍͠஌ࣝΛɻ ϓϩάϥϛϯάʹࣗ৴͕ແ͍ͳΒ͹ɺͳ͓͞Βɺ͜͏͍ͬͨ΋ͷʹै͏΂͖ɻ 66

Slide 67

Slide 67 text

ͦͯ͠ 67

Slide 68

Slide 68 text

WordPress ίϛϡχςΟͷࡒ࢈Λ׆༻͠Α͏ɻ ͜Ε͕ WordPressͷҰ൪ͷڧΈɻ 68

Slide 69

Slide 69 text

ࠔͬͨΒϑΥʔϥϜͰ࣭໰ͯ͠ΈΑ͏ɻ • https://ja.wordpress.org/support/ • WordPress ͷެࣜͷαϙʔτϑΥʔ ϥϜɻ • ͪΌΜͱ࣭໰͢Δͱ݁ߏղ౴͕ͭ ͘ɻ • ϑΥʔϥϜΛݕࡧ͢Δͱ౴͕͑͋ͬ ͨΓ͢Δ͜ͱ΋Α͋͘Δɻ 69

Slide 70

Slide 70 text

tips • titleλάΛςʔϚʹॻ͘ͷ͸ඇਪ঑ʹɻ add_theme_support('title-tag') Λ࢖͍·͠ΐ͏ɻ • ࠷ۙ get_theme_file_uri ͱݴ͏ؔ਺͕௥Ճ͞Εͨɻ • ςʔϚΧελϚΠβʔ • etc... ·ͩ·ͩԞ͕ਂ͍ɻ 70

Slide 71

Slide 71 text

more...? 71

Slide 72

Slide 72 text

ΤϯδχΞͷͨΊͷ WordPress։ൃೖ໳ 72

Slide 73

Slide 73 text

ϊϯϓϩάϥϚʔͷͨΊͷWordPress ςʔϚ࡞੒εςοϓΞοϓज़ https://www.slideshare.net/ mignonstyle/wordpress-stepuptips 73

Slide 74

Slide 74 text

and.. Let's Join WordBench! wordbench.org 74

Slide 75

Slide 75 text

and... 75

Slide 76

Slide 76 text

76

Slide 77

Slide 77 text

WordCamp Kyoto 2017 • 06/24, 25 • ژ౎େֶ ࠃࡍՊֶΠϊϕʔγϣϯ౩ WordCamp is... ੈքத֤஍ͰߦΘΕ͍ͯΔ WordPress ͷΧϯϑΝϨϯεɻ೔ຊͰ Ұ൪େ͖͍WordPressͷΠϕϯτɻࠓ೥͸ژ౎ͱ౦ژʹͯ։࠵ɻ 77

Slide 78

Slide 78 text

78

Slide 79

Slide 79 text

͓ΘΓɻ Thanks! Github: @torounit Twitter: @Toro_Unit Facebook: fb.me/torounit WEB Site: https://torounit.com 79