Description
Enqueue the defined jQuery source file(s)If the src= parameter is set and it's a numeric value then treat this as an attachment ID else treat it as the URL otherwise load the attached jQuery files and enqueue those.
Usage
bw_jquery_src( $atts );Parameters
- $atts
- ( mixed ) required – array that may contain src=ID or src=URL
Returns
voidSource
File name: oik/shortcodes/oik-jquery.phpLines:
1 to 19 of 19
function bw_jquery_src( $atts ) { $src = bw_array_get( $atts, "src", null ); // bw_trace2( $src ); if ( $src ) { if ( is_numeric( $src ) ) { $src = wp_get_attachment_url( $src ); } $inline = bw_array_get( $atts, "inline", false ); $inline = bw_validate_torf( $inline ); if ( $inline ) { bw_jquery_javascript( $src ); } else { wp_enqueue_script( sanitize_key( $src ), $src, array( "jquery"), null ); } } else { bw_jquery_enqueue_attached_scripts(); } }View on GitHub View on Trac
Invoked by
Calls
1 to 4 of 4
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_jquery_enqueue_attached_scripts() – Enqueue any attached scripts
- bw_jquery_javascript() – Directly add the jQuery/JavaScript file to the generated HTML
- bw_validate_torf() – Validate as true or false
