8 votes

Enhance "Advanced Gallery" type: Slider to have continuous loop.

This request is to add a continuous loop effect to the slider type of Advanced Gallery. The Advanced Gallery block has a "slider" type that shows a sequence of slides. When you get to the final slide, the display "rewinds" back to the first slide. The Slider type does not have a built-in function to have a continuous loop effect. A continuous loop would go from the final slide straight to the first slide without a "rewind" effect. Thanks. Phil.
phil2 shared this idea

One Comment

  1. Note that Bonn in support has a great temporary fix for this. Add the following snippet and add a class “infinite” to the Advanced Gallery block:

    add_filter( ‘render_block’, ‘slider_gallery’, 10, 2 );
    function slider_gallery( $block_content, $block ){
    if ( $block[‘blockName’] === ‘kadence/advancedgallery’ && $block[‘attrs’][‘type’] === ‘slider’ && strpos($block[‘attrs’][‘className’], ‘infinite’) !== false ) {
    $block_content = str_replace(
    ‘data-slider-type=”slider”‘,
    ‘data-slider-type=”loop”‘,
    $block_content);
    }
    return $block_content;
    }

Leave a Reply