/**
* Enables video autoplay in the Enfold Fullwidth/Fullscreen Slider even on mobile devices,
* but ONLY for self-hosted HTML5 videos AND ONLY if no mobile fallback image has been set
* in the Enfold backend (data-mobile-img is empty).
* If a fallback image is set, Enfold's default behavior remains unchanged.
*
* IMPORTANT: Enfold outputs the class attribute for these sliders using
* single quotes (class=‘...’), not double quotes.
*/
add_filter( 'do_shortcode_tag', function( $output, $tag, $attr, $m ) {
$relevant_tags = array( 'av_slideshow_full', 'av_fullscreen' );
if ( ! in_array( $tag, $relevant_tags, true ) ) {
return $output;
}
return preg_replace_callback(
'/<li\b[^>]*>/i',
function( $li_matches ) {
$li = $li_matches[0];
if ( strpos( $li, 'av-video-service-html5' ) === false
|| strpos( $li, 'av-mobile-fallback-image' ) === false ) {
return $li;
}
if ( preg_match( '/data-mobile-img=([\'"])(.*?)\1/', $li, $img_matches ) ) {
$mobile_img = trim( $img_matches[2] );
if ( '' !== $mobile_img ) {
// Fallback image is set -> Maintain Enfold's default behavior
return $li;
}
}
return preg_replace_callback(
'/class=([\'"])(.*?)\1/',
function( $class_matches ) {
$quote = $class_matches[1];
$classes = trim( preg_replace( '/\s+/', ' ',
str_replace( 'av-mobile-fallback-image', '', $class_matches[2] )
) );
return 'class=' . $quote . $classes . $quote;
},
$li
);
},
$output
);
}, 10, 4 );Adresse
Webers Webdesign
Ludwig-Schopp-Straße 27
53117 Bonn