Perhaps it would be easier to write a shortcode that you apply only when you need it, namely once to add the script and style elements?
Perhaps it would be easier to write a shortcode that you apply only when you need it, namely once to add the script and style elements?