I want to add some javascript directly below content, added by another plugin's shortcode.
We are using the NextGen Gallery plugin and there are many articles containing the [nggallery] shortcode. I don't want to change all articles and I don't want to inform all authors to use another shortcode in the future. And I also don't want to modify the original plugin.
Is there a way to modify a shortcode like:
function put_script_after_nggallery_shortcode( $atts ){
return "[nggallery $atts] <script>foo();</script>";
}
add_shortcode( 'nggallery', 'put_script_after_nggallery_shortcode' );
or should I hook somehow into the rendering process of the_content() to put my script directily in the_content string after [nggallery id=nnn]. Could that be done with a filter for the_content?