You appear to be a bot. Output may be restricted
Description
Enqueue any attached scriptsUsing the [bw_jq] shortcode without any parameters will load any application/javascript files which have been attached to the current post This is useful when someone provides you with some JavaScript to run on a page and you don't know how to do it.
Usage
bw_jquery_enqueue_attached_scripts();
Parameters
Returns
voidSource
File name: oik/shortcodes/oik-jquery.phpLines:
1 to 13 of 13
function bw_jquery_enqueue_attached_scripts() { oik_require( "includes/bw_posts.php" ); $atts = array( "post_type" => "attachment" , "post_mime_type" => "application/javascript" ); $posts = bw_get_posts( $atts ); if ( $posts ) { foreach ( $posts as $post ) { $src = wp_get_attachment_url( $post->ID ); $enqueued = wp_enqueue_script( sanitize_key( $src ), $src, array( "jquery") ); } } }View on GitHub View on Trac