Change WordPress Shortcode added in to post

Problem: I am using a plugin that turns the wordpress gallery into a cool slide show.

How ever, every time I make a gallery – WordPress add this code to the post .

Read More

I need it to be this –

[wp-slideshow include=”334,332″]


Might be helpful:
I think this is the file controlling the output?

http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/media.php#L745

Related posts

Leave a Reply

2 comments


  1. remove_shortcode( 'gallery' );
    add_shortcode( 'gallery', function( $atts ) {
    $atts = shortcode_atts( array( 'ids' => '' ), $atts );
    return do_shortcode( "[wp-slideshow include="$atts[ids]"]" );
    } );

    This may be better than replacing the gallery shortcode as if you decide to change plugin you will have the standard gallery shortcode which many plugins will work with directly.

  2. @MagentaCuda’s solution is the simple solution and should function adequately. However, it does run the rather complicated shortcode regex twice, plus the additional processing of the do_shortcode() call. Both should be avoidable.

    You don’t name the plugin you are using and a search reveals many possibilities that I don’t have the time to dig through, so here is an out line and proof of concept code.

    The idea is to avoid the second complex shortcode sequence by calling the plugin’s shortcode processing function directly.

    // The callback for the wp-slideshow shortcode
    // I don't know the real function name
    function plugin_gallery_shortcode( $atts, $content = null ) {
      $atts = shortcode_atts( 
        array( 'include' => '' ), 
        $atts 
      );
      var_dump($atts);
    }
    add_shortcode('wp-slideshow','plugin_gallery_shortcode');
    
    // This is a callback we are using to hijack the Core gallery
    function convert_gallery_shortcode( $atts, $content = null ) {
      $atts = shortcode_atts( 
        array( 'ids' => '' ), 
        $atts 
      );
      $atts['include'] = $atts['ids'];
      unset($atts['ids']);
      plugin_gallery_shortcode($atts,$content);
    }
    // only hijack if the plugin gallery callback exists
    if (function_exists('plugin_gallery_shortcode')) {
      add_shortcode('gallery','convert_gallery_shortcode');
    }