Site Tools


New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
wordpress_gallery_carousel_hack
	<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="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;,&quot;keywords&quot;:&quot;Array&quot;}" 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="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;,&quot;keywords&quot;:&quot;Array&quot;}" 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>

07.07.18

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

wordpress_gallery_carousel_hack.txt · Last modified: 2021/10/31 10:42 by 127.0.0.1