NextGEN Gallery
[slideshow] shortcode shared with slideshow-gallery-pro (5 posts)

  1. bobbingwide
    Posted 5 years ago #

    I use both NextGen-gallery and slideshow-gallery-pro. Both plugins implement the [slideshow] shortcode.
    In order to use both plugins on the same site I have had to hack each routine to create new shortcodes which are unique [ngslideshow] and [gpslideshow]
    I've written to the author of slideshow-gallery-pro asking if he can change his shortcode.
    Similalry, I'm asking here.
    Perhaps we can come up with a win-win solution that works for both.

  2. Justin Tadlock
    WordPress God
    Posted 5 years ago #

    You don't need to change the plugins. You can just register your own shortcodes:

    add_action( 'init', 'my_register_shortcodes' );
    function my_register_shortcodes() {
    	add_shortcode( 'ngslideshow', 'ng_slideshow_function_name_here' );
    	add_shortcode( 'gpslideshow', 'gp_slideshow_function_name_here' );
  3. bobbingwide
    Posted 5 years ago #

    The reasons I didn't register the shortcodes in my own routines were multi-fold.

    1. I wanted to make people aware of the problem
    2. I didn't really want to develop a workaround as that could end up being more effort than it's worth
    3. I didn't know how to code the second parameter given that both of the plugins were written as classes

    But now I have persevered.
    For the NextGen slideshow I wrote one line of code
    add_shortcode( 'ngslideshow', 'NextGEN_shortcodes::show_slideshow' );

    For slideshow gallery pro, I didn't know what name to use for the 'embed' function which is defined in class Gallery extends GalleryPlugin

    So I wrote the following

    add_shortcode( 'gpslideshow', 'bw_gp_slideshow' );
    function bw_gp_slideshow( $atts ) {
      $Gallery = new Gallery();
      $content = $Gallery->embed( $atts );
      return $content;

    As you can see I haven't tested to see if the method exists and the plugins are enabled. But at least I have got them working without the hacks. So thanks for that.

  4. cpres
    Posted 5 years ago #

    gpslideshow is an official shortcode from now on :)

  5. bobbingwide
    Posted 5 years ago #

    Thanks. I had a bit more fun with slideshow-gallery-pro last weekend - a combination of user error AND poor coding.
    You can read about it at

    I have subsequently changed my oik plugin so that I can I avoid the problem in the future.

    add_shortcode( 'gpslides', 'bw_gp_slideshow' );
    function bw_gp_slideshow( $atts, $hmm=NULL, $tag=NULL ) {
      if ( 'the_content' == current_filter() )
        $Gallery = new Gallery();
        $content = $Gallery->embed( $atts );
        $content = '[' . $tag . ']';
      return $content;

    The reason I did this was to prevent the shortcode from being expanded when do_shortcodes is invoked for 'the_title'

    PS. IMHO I think there could be some improvements in WordPress's shortcode handling.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • NextGEN Gallery
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic