• 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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' );
    }
    Thread Starter bobbingwide

    (@bobbingwide)

    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.

    gpslideshow is an official shortcode from now on ??

    Thread Starter bobbingwide

    (@bobbingwide)

    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
    https://www.bobbingwidewebdesign.com/2011/07/17/help-needed-with-oik-at-wordcampuk/

    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 );
      }
      else
        $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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[slideshow] shortcode shared with slideshow-gallery-pro’ is closed to new replies.