<div data-carousel-extra='{"blog_id":1,"permalink":"https:\/\/blog.project-insanity.org\/blog\/2018\/04\/24\/auto-update-android-apps-with-f-droid-yalp-store\/","likes_blog_id":false}' id='gallery-1' class='gallery'><dl class='gallery-item'> <dt> <a href='https://blog.project-insanity.org/blog/2018/04/24/auto-update-android-apps-with-f-droid-yalp-store/f-droid_2/'><img width="113" height="200" src="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" class="attachment-thumbnail size-thumbnail" alt="" aria-describedby="gallery-1-4369" data-attachment-id="4369" data-orig-file="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" data-orig-size="540,960" data-comments-opened="0" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0","keywords":"Array"}" data-image-title="f-droid_2" data-image-description="" data-medium-file="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" data-large-file="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" /></a> </dt> <dd class='wp-caption-text gallery-caption' id='gallery-1-4369'> F-Droid settings 1 </dd></dl><br style="clear: both" /> </div>
<div data-carousel-extra='{"blog_id":1,"permalink":"https:\/\/blog.project-insanity.org\/blog\/2018\/04\/24\/auto-update-android-apps-with-f-droid-yalp-store\/","likes_blog_id":false}' id='gallery-1' class='gallery'><dl class='gallery-item'> <dt> <a href='https://blog.project-insanity.org/blog/2018/04/24/auto-update-android-apps-with-f-droid-yalp-store/f-droid_2/'><img width="113" height="200" src="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" class="attachment-thumbnail size-thumbnail" alt="" aria-describedby="gallery-1-4369" data-attachment-id="4369" data-orig-file="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" data-orig-size="540,960" data-comments-opened="0" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0","keywords":"Array"}" data-image-title="f-droid_2" data-image-description="" data-medium-file="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" data-large-file="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" /></a> </dt> <dd class='wp-caption-text gallery-caption' id='gallery-1-4369'> F-Droid settings 1 </dd></dl><br style="clear: both" /> </div> <div data-carousel-extra='{"blog_id":1,"permalink":"https:\/\/blog.project-insanity.org\/blog\/2018\/04\/24\/auto-update-android-apps-with-f-droid-yalp-store\/","likes_blog_id":false}' id='gallery-1' class='gallery'><dl class='gallery-item'> <dt> <div id="attachment_4290" style="width: 635px" class="wp-caption aligncenter"><a href="https://www.project-insanity.org/wp-content/uploads/2017/10/2017-10-27-164927_swaygrab.png"><img class="wp-image-4290 size-large" src="https://www.project-insanity.org/wp-content/uploads/2017/10/2017-10-27-164927_swaygrab-720x375.png" alt="" srcset="https://blog.project-insanity.org/wp-content/uploads/2017/10/2017-10-27-164927_swaygrab-720x375.png 720w, https://blog.project-insanity.org/wp-content/uploads/2017/10/2017-10-27-164927_swaygrab-300x156.png 300w, https://blog.project-insanity.org/wp-content/uploads/2017/10/2017-10-27-164927_swaygrab-624x325.png 624w, https://blog.project-insanity.org/wp-content/uploads/2017/10/2017-10-27-164927_swaygrab.png 1440w" sizes="(max-width: 625px) 100vw, 625px" width="625" height="326"></a><p class="wp-caption-text">Create power point presentations directly in Nextcloud</p></div> </dt> <dd class='wp-caption-text gallery-caption' id='gallery-1-4369'> F-Droid settings 1 </dd></dl><br style="clear: both" /> </div>
assure that assets are loaded on every page, not only enqued with add_filter('post_gallery'). in function init() append following two strings after add_filter[…]:
add_filter( 'post_gallery', array( $this, 'enqueue_assets' ), 1000, 2 ); // load later than other callbacks hooked it add_filter( 'post_gallery', array( $this, 'set_in_gallery' ), -1000 ); add_filter( 'gallery_style', array( $this, 'add_data_to_container' ) ); add_filter( 'wp_get_attachment_image_attributes', array( $this, 'add_data_to_images' ), 10, 2 ); wp_enqueue_script( 'jetpack-carousel', plugins_url( 'jetpack-carousel.js', __FILE__ ), array( 'jquery.spin' ), $this->asset_version( '20140505' ), true ); wp_enqueue_style( 'jetpack-carousel', plugins_url( 'jetpack-carousel.css', __FILE__ ), array(), $this->asset_version( '20120629' ) );
in the wordpress post, test:
<div data-carousel-extra='{"blog_id":1,"permalink":"https:\/\/blog.project-insanity.org\/blog\/2018\/04\/24\/auto-update-android-apps-with-f-droid-yalp-store\/","likes_blog_id":false}' id='gallery-1' class='gallery'> <dl class='gallery-item'> <dt> <a href='https://blog.project-insanity.org/blog/2018/04/24/auto-update-android-apps-with-f-droid-yalp-store/f-droid_2/'> <img width="200" src="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" data-attachment-id="4369" data-orig-file="https://blog.project-insanity.org/wp-content/uploads/2018/04/f-droid_2.png" data-orig-size="540,960" /> </a> </dt> <dd class='wp-caption-text gallery-caption' id='gallery-1-4369'> F-Droid settings 1 </dd> </dl> <br style="clear: both" /> </div> [gallery] </html>
[gallery] shortcode is needed for script to work. script seems to relay on data-orig-file
, data-attachment-id
image attributes