Adding a parameter

This commit is contained in:
Eric van der Vlist 2025-03-24 17:56:50 +01:00
parent f4d3c983e7
commit 37c790d36b
2 changed files with 22 additions and 6 deletions

View File

@ -3,6 +3,14 @@
* @see https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#render * @see https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#render
*/ */
?> ?>
<p <?php echo get_block_wrapper_attributes(); ?>> <div class="attached-gpxes" <?php echo get_block_wrapper_attributes(); ?>>
<?php esc_html_e( 'Attached GPXes – hello from a dynamic block!', 'wp-attached-gpx' ); ?> <?php
</p> $gpxes = get_attached_media('application/gpx+xml');
foreach ($gpxes as $id => $gpx) {
$url = wp_get_attachment_url($id);
echo '<div class="attached-gpx">'.wpgpxmaps_handle_shortcodes(['gpx'=>$url, 'attachments'=>true]).'</div>';
}
?>
</div>

View File

@ -3,6 +3,14 @@
* @see https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#render * @see https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#render
*/ */
?> ?>
<p <?php echo get_block_wrapper_attributes(); ?>> <div class="attached-gpxes" <?php echo get_block_wrapper_attributes(); ?>>
<?php esc_html_e( 'Attached GPXes – hello from a dynamic block!', 'wp-attached-gpx' ); ?> <?php
</p> $gpxes = get_attached_media('application/gpx+xml');
foreach ($gpxes as $id => $gpx) {
$url = wp_get_attachment_url($id);
echo '<div class="attached-gpx">'.wpgpxmaps_handle_shortcodes(['gpx'=>$url, 'attachments'=>true]).'</div>';
}
?>
</div>