• I have slider plugin in form of shortcode that’s very similar to default gallery, using the same parameters (other than columns). So when i want to create one i use default gallery creator and simply change part of generated shortcode from [gallery… to [slider…

    Is it possible to duplicate that gallery creator changing just name and shortcode output name ?

    Or adding some kind of dropdown to select shortcode name output only ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    There’s a few ways to handle this, though maybe not in the way you were thinking. There are some filters for content just before it’s inserted into the editor. I don’t know where the one for the media gallery is though. The media gallery is largely javascript, so it may be able to be overridden that way to. The override could certainly have a dropdown added.

    What I would do is identify the callback for the slider shortcode. Remove the default gallery shortcode, then add it back in using the slider callback instead of gallery_shortcode().

    Another possibility is let the gallery shortcode be and hook the ‘post_gallery’ filter and handle the slider output that way. In both of these scenarios, you add the gallery shortcode as usual, but the output is actually the slider’s instead.

    Thread Starter Ciredor

    (@ciredor)

    https://wordpress.org/plugins/wc-gallery/

    This plugin have exactly what i want it seems. Time to dig in and undarstand it’s code 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Duplicate default gallery creator ?’ is closed to new replies.