<div class="owl-carousel slider">
<div class="slider__content">
<?php if( have_rows('content_for_slider') ): ?>
<?php while( have_rows('content_for_slider') ): the_row(); ?>
<?php
$image = get_sub_field('slide_pic');
$content = get_sub_field('slide_text');
$link = get_sub_field('slide_link');
$form = get_sub_field('slide_form');
?>
<div
class="slider__slide"
style="background-image: url(<?php echo $image['url']; ?>)"
alt="<?php echo $image['alt'] ?>"
>
<div class="container">
<div class="row align-items-center">
<?php if( $link ): ?>
<a href="<?php echo $link; ?>">link</a>
<?php endif; ?>
<div class="col-md-5 col-xs-12 col-sm-8">
<div class="slider__idents ">
<?php echo $content; ?>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
function filter_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) {
$html = sprintf('<a href="#" data-rel="lightbox-0"><img alt="%2$s" src="%1$s" /></a>', esc_attr(esc_url($url)), esc_attr($title));
return $html;
}
add_filter('image_send_to_editor', 'filter_image_send_to_editor', 10, 8);
function ccd_fancybox_image_attribute( $content ) {
global $post;
$pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
$replace = '<a$1href=$2$3.$4$5 data-type="image" data-fancybox="image">';
$content = preg_replace( $pattern, $replace, $content );
return $content;
}
add_filter( 'the_content', 'ccd_fancybox_image_attribute' );