dynamic flickr slider shortcode with variable parameters

jproctor's Avatar


03 Oct, 2014 09:25 PM

Greetings -- We use RoyalSlider (WordPress) extensively and it's great. But I just stumbled upon a need, in the context of our Flickr sliders, to generate a generic shortcode and add variable parameters inside the shortcode (which I'd do via Toolset CPT functionality) to specific the Flickr API and set ID. I see for instance a wide variety of parameters here:


and these would be what ordinarily would be available for customization via shortcode parameters. But they don't seem to be associated with the WordPress shortcode; correct? Thanks for any clarification.

Jim P.

  1. Support Staff 1 Posted by Dmitry Semenov on 04 Oct, 2014 06:27 PM

    Dmitry Semenov's Avatar

    Hello Jim,

    I see for instance a wide variety of parameters here: http://dimsemenov.com/plugins/royal-slider/documentation/

    Shortcode action just fetches slider data by ID from database. Parameters that you see on above page are controlled from right sidebar of edit-slider page.

    Please elaborate which exactly parameters do you wish to change and why. And I might offer an alternative solution.


  2. 2 Posted by jproctor on 04 Oct, 2014 07:19 PM

    jproctor's Avatar

    Thanks for your quick response. Yes, I understand that parameters are generally configured for a slider, then the simple slider shortcode (without parameters) added.

    I am supporting a set of overseas programs, and want to make Flickr-related slider presentation as easy as possible for each program. To this end, we would like to devise a default slider that uses the same API and other settings, but it would vary in terms of the set ID, as each program would be assigned a particular Flickr album/set. So, in the simplest case, the only parameter I'd wish to vary in the shortcode (or via other means) would be the set ID.

    If you have an alternative solution for how we could dynamically vary the set ID for a generic slider (as embedded on a WordPress custom post via shortcode) I'd sure appreciate. What we would do, then, is construct a CPT and enter the overseas program title and Flickr set ID on the form; these custom fields would be applied to the slider page for that overseas program, simply by varying the set ID of the RoyalSlider. If need be, we could construct the CPT single display page via PHP template (we ordinarily use the Toolset HTML forms, but I realize this may limit your options).

    Many thanks again,

    Jim P.

  3. Support Staff 3 Posted by Dmitry Semenov on 04 Oct, 2014 08:17 PM

    Dmitry Semenov's Avatar

    You can modify photoset ID via filter like so:

    function modify_slider_flickr_photoset_id_dynamically($data) {
       $options = json_decode($data['options'], ARRAY_A);
       if( isset($options['flickr']) ) {
         $options['flickr']['photoset_id'] = '72157642936095895';
         $data['options'] = json_encode($options);
      return $data;
    add_filter('new_rs_slider_data', 'modify_slider_flickr_photoset_id_dynamically', 20, 2);


    • You'll need to disable caching of slider (set to 0 on Settings page). Which means you'll need to implement some other type of caching by yourself, as if you don't, on each page reload request to Flickr will be sent. Which will lead to huge page load time and you'll just run off Flickr API limit.
    • For now there is no way, to get shortcode parameters data in this filter, so you'll need to get it, for example from meta fields of current page.


  4. 4 Posted by jproctor on 04 Oct, 2014 08:27 PM

    jproctor's Avatar

    Okay, many thanks, Dmitry!

    Jim P.

  5. 5 Posted by lemoslincoln on 02 Dec, 2014 09:29 AM

    lemoslincoln's Avatar


    How you do with cache?
    I'm need use this to and i dont know how i will implement this other cache...

  6. 6 Posted by lemoslincoln on 02 Dec, 2014 09:48 AM

    lemoslincoln's Avatar


    How i can pass the photoset_id via shortcode?

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