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

ブロックエディタ利用を想定したテーマ制作と今後必要なこと / gifuwpm17

Koji Kuno
December 28, 2019

ブロックエディタ利用を想定したテーマ制作と今後必要なこと / gifuwpm17

Koji Kuno

December 28, 2019
Tweet

More Decks by Koji Kuno

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ w ϑϦʔϥϯε8FC੍࡞ऀˏذෞࢢ w 8PSE1SFTT$POUSJCVUPS DPSF  NFFUVQ USBOTMBUJPO QMVHJOEFW

    UIFNFEFW w $PEFS%PKPذෞνϟϯϐΦϯ w άϥϑΟοΫσβΠϯग़਎8FCؔ࿈ձ ࣾۈ຿ྺ͸ͳ͠ w 8FC͸ಠֶ8PSE1SFTTྺ೥Ҏ্ w PMFJOEFTJHODPN!0MFJO@KQ 
  2. /// // Define block colors for in editor. /// @function

    block-colors() { @return ( white : #ffffff, black : #000000, charcoal : #282c34, regent : #8c97a7, husk : #b9a364, red-stage : #b15330 ); } 
  3. /// // Return a single block color value by name

    /// @function block-color( $name ) { @return map-get( block-colors(), $name ); } 
  4. //// /// Create CSS classes for color palette. /// ///

    @author Koji Kuno <[email protected]> //// @each $color-name, $color-value in block-colors() { .has-#{ $color-name }-color { color : #{ $color-value }; } .has-#{ $color-name }-background-color { background-color: #{ $color-value }; } } 
  5. ϒϩοΫΤσΟλͷ৔߹ .editor-styles-wrapper { background-color: yellow; } ΫϥγοΫΤσΟλͷ৔߹ body { background-color:

    yellow; } ΫϥγοΫΤσΟλͷ৔߹ɺ<body id="tinymce" class="mce-content-body"> ͷதʹฤूը໘͕ͭ͘ΒΕ͍ͯΔͷͰ 
  6. <?php add_action( 'after_setup_theme', function() { add_theme_support( 'align-wide' ); } ?>

    .alignfullͱ.alignwideͱ͍͏$44ΫϥεʹରԠ͢Δඞཁ͕͋Δ 
  7. .alignfull { width:100vw; margin-left: calc( (100vw - $content_width ) *

    -0.5); ɹmax-width:100vw; } .alignwide { width:calc( $content_width + $added_width ); margin-left: $added_width / 2; max-width:100vw; } 
  8. add_action( 'after_setup_theme', function() { add_theme_support( 'editor-color-palette', [ [ 'name' =>

    __( 'Gray' ), 'slug' => 'gray', 'color' => '#555555' // use this for inline style. ], [ ... ] ] ); } 
  9. add_action( 'after_setup_theme', function() { add_theme_support( 'editor-font-sizes', [ [ 'name' =>

    __( 'Small' ), 'shortName' => __( 'S' ), 'size' => 12, // use this for inline style. 'slug' => 'small' ], [ ... ] ] ); } 
  10. ίΞϒϩοΫͷछྨ DPSFQBSBHSBQI DPSFIFBEJOH DPSFJNBHF DPSFRVPUF DPSFHBMMFSZ DPSFMJTU DPSFBVEJP DPSFDPWFS DPSFpMF

    DPSFWJEFP DPSFDPEF DPSFGSFFGPSN DPSFIUNM DPSFQSFGPSNBUUFE DPSFQVMMRVPUF DPSFUBCMF DPSFWFSTF DPSFCVUUPO DPSFDPMVNOT DPSFNFEJBUFYU DPSFNPSF DPSFOFYUQBHF DPSFTFQBSBUPS DPSFTQBDFS DPSFTIPSUDPEF DPSFBSDIJWFT DPSFDBUFHPSJFT DPSFMBUFTUDPNNFOUT DPSFMBUFTUQPTUT DPSFFNCFE DPSFFNCFEUXJUUFS DPSFFNCFEZPVUVCF DPSFFNCFEGBDFCPPL DPSFFNCFEJOTUBHSBN DPSFFNCFEXPSEQSFTT DPSFFNCFETPVOEDMPVE DPSFFNCFETQPUJGZ DPSFFNCFEqJDLS DPSFFNCFEWJNFP DPSFFNCFEBOJNPUP DPSFFNCFEDMPVEVQ DPSFFNCFEDPMMFHFIVNPS DPSFFNCFEEBJMZNPUJPO DPSFFNCFEGVOOZPSEJF DPSFFNCFEIVMV DPSFFNCFEJNHVS DPSFFNCFEJTTVV DPSFFNCFELJDLTUBSUFS DPSFFNCFENFFUVQDPN DPSFFNCFENJYDMPVE DPSFFNCFEQIPUPCVDLFU DPSFFNCFEQPMMEBEEZ DPSFFNCFESFEEJU DPSFFNCFESFWFSCOBUJPO DPSFFNCFETDSFFODBTU DPSFFNCFETDSJCE D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W 
  12. index.php function ob_extending_blocks_enqueue() { wp_enqueue_script( 'ob-extending-blocks-script', plugins_url( 'build/index.js', __FILE__ ),

    array( 'wp-blocks' ) ); } add_action( 'enqueue_block_editor_assets', 'ob_extending_blocks_enqueue' ); 
  13. 

  14. 1)1όʔδϣϯ όʔδϣϯ ϦϦʔε ΞΫςΟϒ ηΩϡϦςΟ     

           IUUQTXXXQIQOFUTVQQPSUFEWFSTJPOTQIQ 
  15. ܹࢗݩ  ࡾ໦ప 5PSV.JLJ (VUFOCFSHҎ߱ͷςʔϚ࡞੒ʹ޲͚ͯɺࠓֶͿ ΂͖͜ͱ  ௕୩઒޿෢ӡ༻΋࠷େݶߟྀʂίʔϙϨʔταΠτͰϒϩοΫΤ σΟλϑϧ׆༻ͷࣄྫ঺հ 

    #MPDL&EJUPSΧελϚΠζೖ໳81NFFUVQ0TBLB εϥΠυɿӡ༻΋࠷େݶߟྀʂίʔϙϨʔταΠτͰϒϩοΫΤσΟλϑϧ׆༻ͷࣄྫ঺հ εϥΠυɿ(VUFOCFSHҎ߱ͷςʔϚ࡞੒ʹ޲͚ͯɺࠓֶͿ΂͖͜ͱ