Guest User

Untitled

a guest
Jan 3rd, 2025
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. function av_acf_slideshow_shortcode($atts) {
  2. $atts = shortcode_atts(array(
  3. 'field' => 'av_acf_slideshow_ids',
  4. ), $atts, 'av_acf_slideshow');
  5.  
  6. $slide_ids = get_field($atts['field']);
  7. $slide_ids_array = $slide_ids ? explode(',', $slide_ids) : [];
  8.  
  9. if (empty($slide_ids_array)) {
  10. return 'No slides available.';
  11. }
  12.  
  13. $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"]';
  14.  
  15. foreach ($slide_ids_array as $slide_id) {
  16. $slideshow .= '[av_slide id="' . esc_attr(trim($slide_id)) . '" element_template="" title="" video=""][/av_slide]';
  17. }
  18.  
  19. $slideshow .= '[/av_slideshow]';
  20.  
  21. return do_shortcode($slideshow);
  22. }
  23.  
  24. add_shortcode('av_acf_slideshow', 'av_acf_slideshow_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment