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

Starter Contentで WordPress構築を効率化

Starter Contentで WordPress構築を効率化

#wbkyoto

75486cbfd37125f121cf4a6c5614601c?s=128

Hidetaka Okamoto
PRO

February 12, 2017
Tweet

Transcript

  1. 4UBSUFS$POUFOUͰ 8PSE1SFTTߏஙΛޮ཰Խ 8PSE#FODIژ౎

  2. w 8 P S E # F O D I

    ژ ౎ Ϟ σ Ϩ ʔ λ  w 8 P S E 1 S F T T ೔ ຊ ޠ ϑ Υ ʔ ϥϜ ੈ ࿩ ໾  w 8 P S E $ B N Q  ,Z P U P      ࣮ ߦ ҕ һ ௕  )JEFUBLB0LBNPUP %JHJUBMDVCF%FWFMPQFS
  3. ɾελʔλʔίϯςϯπͱ͸ʁ ɾελʔλʔίϯςϯπͷ࢖͍ํ ɾίʔυαϯϓϧͷ঺հ ࠓ೔ͷྲྀΕ

  4. ελʔλʔίϯςϯπͱ͸

  5. 5XFOUZ4FWFOUFFO 81σϑΥϧτςʔϚ IUUQTXPSEQSFTTPSHUIFNFTUXFOUZTFWFOUFFO

  6. 8PSE1SFTT্ཱͪ͛௚ޙͷঢ়ଶ ϒϩάهࣄҰཡ͕දࣔ͞ΕͨʮσϑΥϧτঢ়ଶʯ

  7. ؅ཧը໘͔ΒΧελϚΠζը໘Λ։͘ ϓϨϏϡʔͷαΠτද͕͖ࣔͬ͞ͱҟͳ͍ͬͯΔ

  8. ͦͷ··อଘ͢Δͱ ϓϨϏϡʔը໘ͰݟͨαΠτߏ੒ʹ੾ΓସΘ͍ͬͯΔ

  9. ͜Ε͕ ελʔλʔίϯςϯπ

  10. ݻఆϖʔδ΍ ϝχϡʔ ΢ΟδΣοτ΋ ࣗಈੜ੒

  11. w ྑͦ͞͏ͳςʔϚΛ୳ͯ͠Πϯετʔϧ w εΫϦʔϯγϣοτͱॳظද͕ࣔҧ͏ w εΫϦʔϯγϣοτͷදࣔʹؤு͚ͬͯۙͮΔ w ʮࢥͬͯͨͷͱҧ͏͔Βଞͷʹͯ͠ʯ w ςʔϚΛม͑Δ

    w ʮ͖ͬ͞ͷςʔϚͱઃఆํ๏ҧ͏Μ͚ͩͲʯ ͜Ε·Ͱͷ8PSE1SFTTαΠτ੍࡞
  12. l z ΊΜͲ͍͔͘͞Β ࣗ෼Ͱ࡞ͬͪΌ͑

  13. w ʮ8PSE1SFTTߋ৽ͨ͠ΒյΕ·ͨ͠ʯ w ʮϓϥάΠϯ௥Ճͨ͠ͷʹදࣔมΘΜͳ͍ʯ w ʮͳΜ͔όάͬͯ·͢ʯ w ʮͦΖͦΖσβΠϯม͍͑ͨ͠ɺอक಺ͰϤϩʯ ࣗ෼Ͱ࡞ͬͨ݁Ռ

  14. ΊΜͲ͍͘͞ ͭΒ͍

  15. l z ͏ͪอक΍Μͳ͍͔Β େৎ෉ͬ͢

  16. ΢ΣϒαΠτʹΑΔ঎඼ͷड஫γεςϜΛར༻ͨ͠ސ٬ ͷΫϨδοτΧʔυ৘ใ͕ྲྀग़ͨ͠ ࣄނʹ͖ͭɺγεςϜͷઃܭɺ੡࡞ɺอक౳ͷडୗۀऀ ͷ࠴຿ෆཤߦʹجͮ͘ँࡑɾ໰߹ͤ ౳ͷސ٬ରԠඅ༻ɺച্ଛࣦ౳ͷଛ֐ഛঈ੹೚͕ߠఆ͞ Εͨࣄྫ ౦ژ஍ํࡋ൑ॴ൑ܾʗฏ੒̎̏೥ʢϫʣୈ̏̎̌̒̌߸ ฏ੒̎̒೥݄̍̎̏೔ http://www.softic.or.jp/semi/2014/5_141113/op.pdf

  17. ೲ඼෺ʹ ط஌ͷ੬ऑੑ͕͋Δͱ ੹೚໰୊ʹͳΓ͏Δ

  18. https://www.ipa.go.jp/security/ciadr/vul/20140619-oldcms.html

  19. https://getshifter.io/

  20. None
  21. 8PSE1SFTTͷ ॳظηοτΞοϓ͸ ͘͢͝େมͩͬͨ

  22. l z The part of NUX(new user experience.) that I

    would like to start tackling in 4.7 is initial site setup https://helen.wordpress.com/2016/07/13/theme-disconnect-and-discontent/
  23. 5XFOUZ4FWFOUFFO 81σϑΥϧτςʔϚ IUUQTXPSEQSFTTPSHUIFNFTUXFOUZTFWFOUFFO

  24. w ྑͦ͞͏ͳςʔϚΛ୳ͯ͠Πϯετʔϧ w εΫϦʔϯγϣοτͷ಺༰͕ϓϨϏϡʔͰ͖Δ w ʮࢥͬͯͨͷͱҧ͏͔Βଞͷʹͯ͠ʯ w ςʔϚΛม͑Δ w εΫϦʔϯγϣοτͷ಺༰͕ϓϨϏϡʔͰ͖Δ

    w ؾܰʹςʔϚΛࢼͤΔ ελʔλʔίϯςϯπͷ͋Δ8PSE1SFTT
  25. ελʔλʔίϯςϯπ ͷ ࢖͍ํ

  26. ؅ཧը໘͔ΒΧελϚΠζը໘Λ։͚ͩ͘ ελʔλʔίϯςϯπ͕͋Δ৔߹͸ɺϓϨϏϡʔը໘ͷද͕ࣔσϑΥϧτ͡Όͳ͘ͳΔ

  27. 5JQTελʔλʔίϯςϯπ͸ॳظঢ়ଶͷΈ $ wp option update fresh_site true or <?php update_option(‘fresh_site',1);

    ?> w XQ@PQUJPOͷAGSFTI@TJUFAͰ൑ఆ͍ͯ͠Δɻ w Ұ౓αΠτΛฤू͢Δͱར༻Ͱ͖ͳ͍ɻ w ΋͏Ұ౓ར༻͢ΔͨΊʹ͸GSFTI@TJUFΛมߋ͢Δ
  28. ελʔλʔίϯςϯπ͸ ίΞʹఆٛ͞Ε͍ͯΔͷͰɺ ͲͷςʔϚͰ΋ར༻Մೳ

  29. ίΞʹఆٛ͞Ε͍ͯΔ IUUQTDPSFUSBDXPSEQSFTTPSHCSPXTFSUSVOLTSDXQJODMVEFT UIFNFQIQ- $core_content = array( 'widgets' => array( 'text_about'

    => array( 'text', array( 'title' => _x( 'About This Site', 'Theme starter content' ), 'text' => _x( 'This may be a good place .’ ), ) ),
  30. 5XFOUZ4JYUFFOʹελʔλʔίϯςϯπΛద༻ ΧελϚΠζը໘ͰςʔϚΛ੾Γସ͑ͳ͍ͱɺXQPQUJPO͕ߋ৽͞Εͯදࣔ͞Εͳ͍

  31. ࠓͷͱ͜Ζɺ ελʔλʔίϯςϯπ ରԠςʔϚ Λௐ΂Δํ๏͸ͳ͍

  32. ελʔλʔίϯςϯπ ͷ ίʔυͷ࿩

  33. ஫ҙ εϥΠυͷؔ܎্ɺ εϥΠυ্ͷαϯϓϧίʔυ͸ ෆ׬શͰ͢ɻ

  34. http://bit.ly/2l488BF

  35. جຊతͳॻ͖ํ BEE@UIFNF@TVQQPSU bTUBSUFSDPOUFOU` ࿈૝഑ྻ  add_theme_support( 'starter-content', [ 'posts' =>

    [], 'attachments' => [], 'options' => [], 'nav_menus' => [], 'widgets' => [] ] );
  36. ݻఆϖʔδΛ௥Ճ͢Δ IPNFBCPVUDPOUBDUCMPHͷݻఆϖʔδ͕ ͦΕͧΕଘࡏ͠ͳ͍৔߹ʹࣗಈͰੜ੒͢Δɻ add_theme_support( 'starter-content', [ 'posts' => [ 'home',

    'about', 'contact', 'blog', ], ]);
  37. هࣄ಺༰Λৄࡉʹఆٛ͢Δ QPTUTͷத਎Λ࿈૝഑ྻʹ͢Δͱɺهࣄ಺༰ΛઃఆͰ͖Δ add_theme_support( 'starter-content', [ 'posts' => [ ‘custom_post' =>

    [ 'post_type' => 'post', 'post_title' => 'Hello, Dolly', 'post_name' => 'example-blog-post', 'post_content' => "Hello, Dolly", 'comment_status' => 'closed', ]
  38. ϑΝΠϧΛΞοϓϩʔυ͢Δ BUUBDIFNFOUTͷ഑ྻΩʔΛ\\,&:^^ͷΑ͏ʹ͢Δ͜ͱͰɺ UIVNCOBJMΛઃఆͰ͖Δɻ add_theme_support( 'starter-content', array( 'attachments' => array( 'featured-image-logo'

    => array( 'post_title' => 'Featured Logo', 'file' => 'assets/images/featured-logo.jpg', ), ), 'posts' => array( 'about' => array( 'thumbnail' => '{{featured-image-logo}}', ),
  39. ϑϩϯτϖʔδΛઃఆ͢Δ lPQUJPOTzʹ\\1045@/".&^^Λ౉ͯ͠ϑϩϯτϖʔδΛઃఆͰ͖Δ add_theme_support( 'starter-content', [ 'options' => [ 'show_on_front' =>

    'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ], 'posts' => [ 'home', 'blog' ],
  40. ϝχϡʔΛઃఆ͢Δ lOBW@NFOVTzͰϝχϡʔΛఆٛͰ͖Δ zQBHF@1"(&/".&zΛࢦఆ͢ΔͱɺݻఆϖʔδʹϦϯΫͰ͖Δ add_theme_support( 'starter-content', [ 'nav_menus' => [ 'sample_navigation'

    => [ 'name' => __('Sample Navigation', 'id'), 'items' => [ 'home_link', 'page_about',
  41. ϝχϡʔΛઃఆ͢Δ̎ ࿈૝഑ྻͰUJUMFΛઃఆՄೳɻ 63-ʹ͢Δͱ֎෦αΠτΛࢦఆͰ͖Δ 'items' => [ 'custome_page' => [ 'title'

    => 'Contact Page', 'url' => 'page_contact', ], 'custome_link' => [ 'title' => 'Sample', 'url' => 'http://google.com', ], ],
  42. ΢ΟδΣοτΛઃఆ͢Δ lXJEHFUTzʹz΢ΟδΣοτ*%zΛΩʔͱͨ͠࿈૝഑ྻͰ ΢ΟδΣοτΛઃఆͰ͖Δ add_theme_support( 'starter-content', [ 'widgets' => [ 'home-content-top-widget-area'

    => [ 'search', 'archives', ], ], ] );
  43. ΢ΟδΣοτΛઃఆ͢Δͦͷ̎ ΢ΟδΣοτͷୈҰҾ਺͸΢ΟδΣοτλΠϓ ୈೋҾ਺ʹ΢ΟδΣοτ಺༰ΛఆٛͰ͖Δ 'text_custom' => [ 'text', [ 'title' =>

    'Pre-hydrated text widget.', 'text' => 'Sample' ] ], 'meta_custom' => [ 'meta', [ 'title' => 'Pre-hydrated meta widget.',
  44. جຊతʹ͸ɺ ࡞੒ͨ͠ςʔϚͷ GVODUJPOTQIQʹॻ͘

  45. ϓϥάΠϯ͔Βελʔλʔίϯςϯπ add_action('after_setup_theme', function () { add_theme_support( 'starter-content', [ BGUFS@TFUVQ@UIFNFͷϑοΫΛར༻͢Δɻ ϓϥάΠϯ༗ޮԽ࣌ʹ

    VQEBUF@PQUJPO bGSFTI@TJUF   ͨ͠΄͏͕͍͍͔΋
  46. ϓϥάΠϯ͕࡞Δ΢ΟδΣοτΛ࢖͏ BEE@pMUFS bHFU@UIFNF@TUBSUFS@DPOUFOU  ͷϑΟϧλʔΛ࢖͏ function myprefix_starter_content_add_widget( $content, $config )

    { if ( isset( $content['widgets']['home-content-top-widget-area'] ) ) { $content['widgets']['front-side-top-widget-area']['b_custom_widget'] = array( 'wp_widget_vkexunit_profile', array( 'label' => 'Sample profile widget', 'facebook' => 'http://facebook.com', 'profile' => 'profile content' ), ); } return $content; } add_filter( 'get_theme_starter_content', 'myprefix_starter_content_add_widget', 10, 2 );
  47. w ελʔλʔίϯςϯπͰॳظίϯςϯπΛఆٛ w Α͘ॻ͘ίϯςϯπ΍ઃఆΛίʔυԽͰ͖Δ w ࣗ෼༻ελʔλʔίϯςϯπ͕͋Δͱศར͔΋ w ελʔλʔίϯςϯπʹ߹ΘͤͨςʔϚʹظ଴ ·ͱΊ