Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_register_script [ WordPress Function ]

wp_register_script ( $handle, $src, $deps = array(), $ver = false, $in_footer = false )
Parameters:
  • (string) $handle Script name
  • (string) $src Script url
  • (array) $deps (optional) Array of script names on which this script depends
  • (string|bool) $ver (optional) Script version (used for cache busting), set to null to disable
  • (bool) $in_footer (optional) Whether to enqueue the script before </head> or before </body>
Returns:
  • (null)
Defined at:



Register new Javascript file.

Source


<?php
function wp_register_script$handle$src$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();
    }

    
$wp_scripts->add$handle$src$deps$ver );
    if ( 
$in_footer )
        
$wp_scripts->add_data$handle'group');
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics