function artflow_scrolling_gallery_shortcode($atts){// Parse shortcode attributes $atts=shortcode_atts(['template'=>'vertical',// Default template 'page_id'=>2116,// Default page ID],$atts,'scrolling_gallery');ob_start();// Get the specified page $page=get_post($atts['page_id']);if ($page){// Fetch gallery data for the specified page $gallery=get_post_gallery($page->ID,false);if ($gallery && isset($gallery['ids'])){// Set CSS classes for horizontal or vertical scrolling $gallery_class=($atts['template']==='horizontal') ? 'is-horizontal' :'is-vertical';$data_id=($atts['template']==='horizontal') ? '1' :'0';?><div class="iasg is-masked <?php echo esc_attr($gallery_class); ?>" data-id="<?php echo esc_attr($data_id); ?>"><div><?php // Get image IDs from the gallery $image_ids=explode(',',$gallery['ids']);foreach ($image_ids as $image_id){// Fetch image URL and alt text $image_url=wp_get_attachment_image_url($image_id,'full');$image_alt=get_post_meta($image_id,'_wp_attachment_image_alt',true);if ($image_url){?><figure><img src="<?php echo esc_url(/wp-content/themes/artflow/$image_url); ?>" alt="<?php echo esc_attr($image_alt); ?>"></figure><?php}}?></div></div><?php}else{echo '<p>No gallery found for page ID ' . esc_html($atts['page_id']) . '.</p>'}}else{echo '<p>Page not found.</p>'}return ob_get_clean()}// Register the shortcode add_shortcode('scrolling_gallery','artflow_scrolling_gallery_shortcode');