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

Starter Contentで WordPress構築を効率化

Starter Contentで WordPress構築を効率化

#wbkyoto

Hidetaka Okamoto

February 12, 2017
Tweet

More Decks by Hidetaka Okamoto

Other Decks in Technology

Transcript

  1. 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
  2. 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/
  3. 5JQTελʔλʔίϯςϯπ͸ॳظঢ়ଶͷΈ $ wp option update fresh_site true or <?php update_option(‘fresh_site',1);

    ?> w XQ@PQUJPOͷAGSFTI@TJUFAͰ൑ఆ͍ͯ͠Δɻ w Ұ౓αΠτΛฤू͢Δͱར༻Ͱ͖ͳ͍ɻ w ΋͏Ұ౓ར༻͢ΔͨΊʹ͸GSFTI@TJUFΛมߋ͢Δ
  4. ίΞʹఆٛ͞Ε͍ͯΔ 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 .’ ), ) ),
  5. جຊతͳॻ͖ํ BEE@UIFNF@TVQQPSU bTUBSUFSDPOUFOU` ࿈૝഑ྻ  add_theme_support( 'starter-content', [ 'posts' =>

    [], 'attachments' => [], 'options' => [], 'nav_menus' => [], 'widgets' => [] ] );
  6. هࣄ಺༰Λৄࡉʹఆٛ͢Δ 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', ]
  7. ϑΝΠϧΛΞοϓϩʔυ͢Δ 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}}', ),
  8. ϝχϡʔΛઃఆ͢Δ̎ ࿈૝഑ྻͰUJUMFΛઃఆՄೳɻ 63-ʹ͢Δͱ֎෦αΠτΛࢦఆͰ͖Δ 'items' => [ 'custome_page' => [ 'title'

    => 'Contact Page', 'url' => 'page_contact', ], 'custome_link' => [ 'title' => 'Sample', 'url' => 'http://google.com', ], ],
  9. ΢ΟδΣοτΛઃఆ͢Δͦͷ̎ ΢ΟδΣοτͷୈҰҾ਺͸΢ΟδΣοτλΠϓ ୈೋҾ਺ʹ΢ΟδΣοτ಺༰ΛఆٛͰ͖Δ 'text_custom' => [ 'text', [ 'title' =>

    'Pre-hydrated text widget.', 'text' => 'Sample' ] ], 'meta_custom' => [ 'meta', [ 'title' => 'Pre-hydrated meta widget.',
  10. ϓϥάΠϯ͕࡞Δ΢ΟδΣοτΛ࢖͏ 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 );