Si quieres modificar el código html generado por defecto en el bloque galería de Gutenberg puede que te interese el siguiente código código php que tendrías que insertar dentro del archivo functions.php de tu tema y modificarlo a tu gusto.
register_block_type('core/gallery', array('render_callback' => function($attributes, $content) { global $post; $items = count($attributes['ids']); $html = "<div class='wp-block-gallery columns-{$items}'><ul class='blocks-gallery-grid'>"; foreach($attributes['ids'] as $idx => $attachment_id) { // Imagen tamaño if (empty($attributes['sizeSlug'])) { $attributes['sizeSlug'] = 'full'; } $src = wp_get_attachment_url($attachment_id); $srcset = wp_get_attachment_image_srcset($attachment_id, $attributes['sizeSlug'], null); $sizes = wp_get_attachment_image_sizes($attachment_id, $attributes['sizeSlug'], null); // Imagen atributos $attachment = get_post( $attachment_id ); $attachment_meta = array( 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, 'href' => get_permalink( $attachment->ID ), 'src' => $attachment->guid, 'title' => $attachment->post_title ); $figCaption = $attributes['figcaption']; $html .= ' <li class="blocks-gallery-item"> <figure> <div class="gallery-item-modal"> <img src="'.$src.'" alt=" id="wp-image-'.$attachment_id.'" /> </div> <figcaption>'.$attachment_meta['description'].' - '.$figCaption.'</figcaption> </figure> </li>'; } $html .= '</ul></div>'; return $html; }));
Agradezco tu comentario 🤘