Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Real Media Library VC Image Carousel Shortcode
<?php
add_shortcode('folder_vc_image_carousel', 'folder_content');
/**
* Add a [folder_vc_image_carousel] shortcode which uses the Visual
* Composer image carousel. It allows you to read images from a RML
* folder dynamically.
*
* @author arget888
* @see https://codecanyon.net/comments/20396684
*/
function folder_content ($atts) {
$a = shortcode_atts(array(
'folder_id' => 6,
'speed' => 5000,
'title' => '',
'img_size' => 'medium',
'autoplay' => 'yes',
'wrap' => 'yes'
), $atts);
$retstring = ””;
$values = wp_rml_get_attachments($a[‘folder_id’]);
foreach($values as $value) {
$retstring .= $value . ',';
}
return do_shortcode('vc_row[vc_images_carousel images="' . substr($retstring, 0, strlen($retstring)-1) . '" img_size="'.$a['img_size'].'" speed="' . $a['speed'] . '" autoplay="'.$a['autoplay'].'" wrap="'.$a['wrap'].'" title="'.$a['title'].'"]/vc_column');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.