Using RS with ACF gallery field

Scott's Avatar


11 May, 2018 10:04 AM


I have purchased the WP RS plugin and I currently have a gallery setup using Flexslider and images from ACF Pro Gallery Field. Is it possible to edit the below code so I can use RS, if so, what code would i use?

Many thanks


$images = get_field('gallery');

if( $images ): ?>
    <div id="slideritems" class="flexsliderprop preloader">
        <ul class="slides">
            <?php foreach( $images as $image ): ?>
                    <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
            <?php endforeach; ?>
<?php endif; ?>
  1. Support Staff 1 Posted by Dmitry Semenov on 11 May, 2018 12:57 PM

    Dmitry Semenov's Avatar


    You may create RoyalSlider configuration that overrides default gallery and do something like:

    $royalslider_id = 1; // modify with ID of your [gallery] type of slider
    $image_ids = get_field('gallery', false, false);
    $shortcode = '[' . 'gallery royalslider="' . $royalslider_id . '" ids="' . implode(',', $image_ids) . '"]';
    echo do_shortcode( $shortcode );

    As per acf documentation

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac