Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FSE時代におけるWEBサイト制作の研究 #wpshinshu / 2023-05-20 Shinshu WordPress Meetup vol.23

FSE時代におけるWEBサイト制作の研究 #wpshinshu / 2023-05-20 Shinshu WordPress Meetup vol.23

信州 WordPress Meetup in 松本 Vol.23 WordPress とかの話をする会
(https://www.meetup.com/ja-JP/shinshu-wordpress-meetup/events/292446368/) での登壇資料です。

More Decks by Toro_Unit (Hiroshi Urabe)

Other Decks in Programming

Transcript

  1. Toro_Unit ઎෦ ߛ (͏Β΂ ͻΖ͠) • Frontend Developer • WordPress

    Plugin and Theme Developer Github: @torounit Twitter: @Toro_Unit 3
  2. • Gutenberg ͷ։ൃΛͪΐΖͬͱ΍ͬ ͯ·͢ɻ • Shinshu WP Meetup ͷΦʔΨφΠ βʔͯ͠·͢ɻ

    • ϓϥάΠϯ࡞ͬͨΓੲςʔϚ࡞ͬͯ ͨΓ͠·ͨ͠ɻ • WordPress ͷΠϕϯτͰ஻ͬͨΓ͓ ञҿΜͩΓͨ·ʹӡӦख఻ͬͨΓ͠ ͯ·͢ɻ 4
  3. • 5.4 2020೥4݄28೔ • 5.5 2020೥9݄1೔ • 5.6 2021೥1݄31೔ •

    5.7 2021೥3݄16೔ • 5.8 2021೥9݄4೔ • 5.9 2022೥2݄18೔ • 6.0 2022೥7݄1೔ • 6.1 2022೥11݄15೔ • 6.2 2023೥3݄30೔ 7
  4. • ϒϩοΫύλʔϯ / ϒϩοΫόϦΤʔγϣϯ • margin / padding / border

    Λ ؅ཧը໘͔Βઃఆ • άϩʔόϧελΠϧ • άϥσʔγϣϯ / Duotone • theme.json • ϒϩοΫςϯϓϨʔτύʔπ • and more... 8
  5. 11

  6. Full Site Editing ͱ͸ • ུͯ͠FSEɻϑϧαΠτฤूͱ΋༁͞ΕΔɻ • WordPress ͷςʔϚΛ؅ཧը໘͔Βฤूग़དྷΔػೳɻ •

    ϒϩοΫΤσΟλʔͳͷͰɺ౤ߘͱಉ͡ϒϩοΫ͕ར༻Մೳɻ • FSEରԠͷςʔϚ͸ϒϩοΫςʔϚͱݺ͹ΕΔɻҎલͷΑ͏ʹ PHP Ͱ࡞͍ͬͯͨϞϊ͸ΫϥγοΫςʔϚɻ • ϒϩοΫςʔϚͱΫϥγοΫςʔϚ͸ผ෺ɻ 12
  7. 14

  8. 15

  9. 18

  10. 19

  11. 21

  12. 23

  13. 24

  14. ├── assets (ϑΥϯτϑΝΠϧͱ͔) ├── parts (ςϯϓϨʔτύʔπ) │ ├── comments.html │

    ├── footer.html │ ├── header.html │ └── post-meta.html ├── patterns (ϒϩοΫύλʔϯ) │ ├── call-to-action.php │ ├── footer-default.php │ ├── hidden-404.php │ ├── hidden-comments.php │ ├── hidden-no-results.php │ └── post-meta.php ├── style.css ├── styles (σβΠϯͷόϦΤʔγϣϯ) ├── templates (ςϯϓϨʔτ) │ ├── 404.html │ ├── archive.html │ ├── blank.html │ ├── blog-alternative.html │ ├── home.html │ ├── index.html │ ├── page.html │ ├── search.html │ └── single.html └── theme.json 28
  15. theme.json ʹ͍ͭͯ Gutenberg ͷʹؔΘͬͯΔ඿໺͞Μͷ ղઆɻ • ʲWordPress5.9 / 6.0൛ʳtheme.json શղઆ

    • ʲWordPress6.1ʳtheme.json ͷมߋ ఺ • ʲWordPress6.2ʳtheme.json ͷมߋ ఺ 30
  16. <!-- wp:template-part {"slug":"header","tagName":"header"} /--> <!-- wp:group {"tagName":"main","layout":{"type":"constrained"}} --> <main class="wp-block-group">

    <!-- wp:query { "query":{"perPage":10,"pages":0,"postType":"post","order":"desc","orderBy":"date","inherit":true}, "displayLayout":{"type":"flex","columns":3}, "align":"wide","layout":{"type":"default"} } --> <div class="wp-block-query alignwide"> <!-- wp:post-template {"align":"wide"} --> <!-- wp:post-featured-image {"isLink":true,"width":"100%","height":"max(15vw, 30vh)","align":"wide"} /--> <!-- wp:post-title {"isLink":true,"align":"wide"} /--> <!-- wp:post-excerpt /--> <!-- wp:post-date {"isLink":true} /--> <!-- wp:spacer {"height":"var(--wp--preset--spacing--70)"} --> <div style="height:var(--wp--preset--spacing--70)" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer --> <!-- /wp:post-template --> <!-- wp:query-pagination { "paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"space-between"} } --> <!-- wp:query-pagination-previous /--> <!-- wp:query-pagination-next /--> <!-- /wp:query-pagination --> </div> <!-- /wp:query --> </main> <!-- /wp:group --> <!-- wp:template-part {"slug":"footer","tagName":"footer"} /--> 31
  17. CSS ͸ཁΒͳ͍ʁ • ཁΔʂ • theme.json ΍؅ཧը໘Ͱઃఆग़དྷΔελΠϧ͸ݶఆతɻ • ϝσΟΞΫΤϦͱ͔࢖͏ͨΊʹ͸CSSॻ͔͘͠ແ͍ɻ •

    theme.json ΍؅ཧը໘ͰCSSΛهड़ग़དྷΔ͕ɺΤσΟλͰॻ͍ͨํࠓͷͱ͜Ζ ָɻ • ࠓ·Ͱ௨Γ CSS ϑΝΠϧΛ༻ҙͯ͠ॻ͍ͨํָ͕ͳέʔε͕ଟ͍ͱ͸ࢥ͏ɻ • CSS ͕ͱͬͪΒ͔Δͷ͕ਏ͍ͳΒɺtailwind ͱ͔࢖͏ͷ͸͋Γ͔΋͠Εͳ͍ 36
  18. • ϒϩοΫʹΫϥεͷ௥Ճͱ͔Λ͍ͨ͠ -> ϒϩοΫελΠϧ • ஋͕ࣄલઃఆ͞ΕͨϒϩοΫ -> ϒϩοΫόϦΤʔγϣϯ • HTML·ͱΊͯಥͬࠐΊΔΑ͏ʹ͍ͨ͠ɺهࣄͷςϯϓϨʔ

    τ͕ཉ͍͠ -> ϒϩοΫύλʔϯ • ޷͖উखͳHTMLॻ͖͍ͨ -> ΧελϜϒϩοΫ • ෳࡶͳσβΠϯͷݟग़͠ͱ͔ -> ΧελϜϒϩοΫ • 41
  19. Կ͔Β͸͡ΊͨΒྑ͍ʁ • ؅ཧը໘ͰσϑΥϧτςʔϚΛ͍͡Δɻ • Create Block Theme ͰۭͬΆͷςʔϚΛ͍ͬͯ͡ΈΔɻ • CSS

    ॻ͍ͯΈΔɻ • registerBlockStyle ͰϒϩοΫελΠϧ௥Ճͯ͠ΈΔɻ • registerBlockVariation ͰϒϩοΫͷόϦΤʔγϣϯΛ௥Ճͯ͠ΈΔɻ • -------------------------- • ΧελϜϒϩοΫΛ࡞ͬͯΈΔɻ • PHPΰϦΰϦॻ͍ͯϓϥάΠϯ࡞ͬͯΈΔɻ 42