Skip to main content

[WP] Creating RoyalSlider from images attached to post

To override default WordPress [gallery] shortcode:

  1. Create gallery configuration (Create New Slider -> Default WordPress [gallery])
  2. Add royalslider attribute to the sortcode, for example:
[gallery royalslider="YOUR_SLIDER_ID"]

To override all [gallery] shortcodes automatically go to RoyalSlider Settings page and enter ID of slider in option "Override all default WordPress galleries".

Dynamically generating shortcode

You can also use this method to dynamically create slider from image attachment IDs, for example:

// retrieve attachment IDs
$attachment_ids = array(45, 85, 89);

// execute the shortcode
echo do_shortcode('[gallery royalslider="1" ids="' . implode(',', $attachment_ids) . '"]');

If you wish to override default Gutenberg gallery block, this may help https://rshelp.dimsemenov.com/wordpress-royalslider-advanced/wp-overriding-default-gutenberg-gallery-block

Plugin installation video can be found here.