Shortcode callback for add_action(‘wp_footer’)
each time you call the shortcode function, you overwrite the previous script var with the current version. make it an array instead of a string: self::$var[] = $script; and then output with foreach: public static function footer() { foreach( self::$var as $script ){ echo $script; } }