[wp-trac] [WordPress Trac] #56780: shortcode block in block-based template part in a classic theme does not get expanded

WordPress Trac noreply at wordpress.org
Tue Oct 10 08:20:29 UTC 2023


#56780: shortcode block in block-based template part in a classic theme does not
get expanded
-------------------------------------------------+-------------------------
 Reporter:  pbiron                               |       Owner:  costdev
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  high                                 |   Milestone:  6.5
Component:  Editor                               |     Version:  6.1
 Severity:  normal                               |  Resolution:
 Keywords:  has-testing-info has-screenshots     |     Focuses:
  has-patch has-unit-tests changes-requested     |  performance
  needs-testing                                  |
-------------------------------------------------+-------------------------

Comment (by youknowriad):

 Good summary @costdev there are two small issues that force us to adopt a
 different strategy:

  - The `block_template_part` function is now maintained in core and can't
 be modified in Gutenberg.
  - The template part block can't use any code that only lives in the
 Gutenberg plugin (because it's auto imported to core later)
  - The Gutenberg plugin supports two WP versions.

 So the way we should go about this is the following:

  - Update `block_template_part` on Core to duplicate what the template
 part block does (while ensuring the function or the extracted code can be
 reused in the template part block).
  - We'd have to wait that the function has been released since two WP
 releases before making the change in the template part block in the
 Gutenberg plugin to reuse the function in the template part block. The
 other approach would be to use a Gutenberg specific function as a fallback
 in the meantime something like:

 {{{#!php
 <?php
 if ( function_exists( 'block_template_part' ) ) {
    gutenberg_block_template_part();
 } else {
   block_template_part();
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56780#comment:59>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list