wp_enqueue_script [ WordPress Function ]
wp_enqueue_script ( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false )
| See: | |
| Defined at: |
|
Benzer Fonksiyonlar: wp_enqueue_scripts, wp_dequeue_script, wp_enqueue_style, wp_dequeue_style, wp_deregister_script
Enqueues script.
Registers the script if src provided (does NOT overwrite) and enqueues.
Source
<?php
function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
global $wp_scripts;
if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
$wp_scripts = new WP_Scripts();
}
if ( $src ) {
$_handle = explode('?', $handle);
$wp_scripts->add( $_handle[0], $src, $deps, $ver );
if ( $in_footer )
$wp_scripts->add_data( $_handle[0], 'group', 1 );
}
$wp_scripts->enqueue( $handle );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- wp_enqueue_script - WordPress Codex
The safe and recommended method of adding JavaScript to a WordPress generated page is by using wp_enqueue_script() . This function includes the script if it ...
codex.wordpress.org - Adding Scripts Properly to WordPress Part 1 – wp_enqueue_script ...
May 6, 2010 ... Starting in WordPress 2.1 (if I remember correctly), the awesome folks at Automattic gave us the even awesomer function of wp_enqueue_script ...
weblogtoolscollection.com - Adding javascript to your theme using wp_enqueue_script - jQuery ...
TO add a javascript file to your theme its easy to use header.php in your theme folder. However if there are plugins using same script libraries (like jquery,
shailan.com - Wp_enqueue_script | Wptuts+
May 12, 2012 ... As many stated before me: “A good WordPress citizen only loads their files where they're needed”. This principle applies both to front-end and ...
wp.tutsplus.com
Kullanýcý Tartýþmalarý [ wordpress.org ]
- esmi on "How to know JQuery is loaded"
- SiRa-wp on "How to know JQuery is loaded"
- aerlaut on "How to know JQuery is loaded"
- esmi on "How to know JQuery is loaded"
- aerlaut on "How to know JQuery is loaded"
- Workshopshed on "[Plugin: Geolocation] Inline Javascript"
- valx76 on "[Plugin: Smart WYSIWYG Blocks Of Content] Problem with wp_enqueue_script in shortcode"
- ssonali on "Java Script for Header"
- another-webmaster on "[Plugin: WordPress Admin Bar Improved] Debug shows following"
- ssonali on "Java Script for Header"