Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
add_shortcode( 'script_foo', 'sc_script_foo_cb' );
function sc_script_foo_cb( $atts, $content ) {
echo '<script type="text/javascript" src="https://example.com/foo.js" />';
}
/*
Then in your content just use [script_foo] (the first parameter from 'add_shortcode')
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment