Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function av_acf_slideshow_shortcode($atts) {
- $atts = shortcode_atts(array(
- 'field' => 'av_acf_slideshow_ids',
- ), $atts, 'av_acf_slideshow');
- $slide_ids = get_field($atts['field']);
- $slide_ids_array = $slide_ids ? explode(',', $slide_ids) : [];
- if (empty($slide_ids_array)) {
- return 'No slides available.';
- }
- $slideshow = '[av_slideshow img_copyright="" size="featured" control_layout="av-control-default" slider_navigation="av-navigate-arrows av-navigate-dots" nav_visibility_desktop="" nav_arrow_color="" nav_arrow_bg_color="" nav_dots_color="" nav_dot_active_color="" img_copyright_font="" av-desktop-font-img_copyright_font="" av-medium-font-img_copyright_font="" av-small-font-img_copyright_font="" av-mini-font-img_copyright_font="" img_copyright_color="" img_copyright_bg="" animation="slide" transition_speed="" autoplay="false" interval="5" img_scale="" img_scale_end="10" img_scale_direction="" img_scale_duration="3" img_scale_opacity="1" conditional_play="" img_scrset="" lazy_loading="disabled" alb_description="" id="" custom_class="" template_class="" element_template="" one_element_template="" av_uid="av-m2ctangq" sc_version="1.0"]';
- foreach ($slide_ids_array as $slide_id) {
- $slideshow .= '[av_slide id="' . esc_attr(trim($slide_id)) . '" element_template="" title="" video=""][/av_slide]';
- }
- $slideshow .= '[/av_slideshow]';
- return do_shortcode($slideshow);
- }
- add_shortcode('av_acf_slideshow', 'av_acf_slideshow_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment