[wp-trac] [WordPress Trac] #48039: Backport block styles server functions from Gutenberg to core

WordPress Trac noreply at wordpress.org
Sat Sep 14 14:54:35 UTC 2019


#48039: Backport block styles server functions from Gutenberg to core
------------------------------+-----------------------------
 Reporter:  jorgefilipecosta  |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 This patch backports the block styles functionality added to the block
 editor in https://github.com/WordPress/gutenberg/pull/16356 to the core of
 WordPress.
 Thew block editor was recently updated include this functionality only if
 it not available in core, so it is compatible with the last version of
 WordPress and trunk.

 == How to test

 I added the following code to the functions.php file of the enabled theme
 and verified styles were  registered as expected:

 {{{#!php
 add_action(
         'enqueue_block_assets',
         function() {
                 wp_register_style( 'myguten-style',
 get_template_directory_uri() . '/custom-style.css' );
         }
 );

 register_block_style(
         'core/quote',
         array(
                 'name'         => 'fancy-quote',
                 'label'        => 'Fancy Quote',
                 'style_handle' => 'myguten-style',
         )
 );

 register_block_style(
         'core/quote',
         array(
                 'name'         => 'not-fancy-quote',
                 'label'        => 'Not Fancy Quote',
                 'inline_style' => '.wp-block-quote.is-style-not-fancy-
 quote { color: blue; }',
         )
 );

 register_block_style(
         'core/quote',
         array(
                 'name'         => 'unregistered-fancy-quote',
                 'label'        => 'Unregistered Fancy Quote',
                 'inline_style' => '.wp-block-quote.is-style-unregistered-
 fancy-quote { color: orange; }',
         )
 );
 unregister_block_style( 'core/quote', 'unregistered-fancy-quote' );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48039>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list