how to add wp_enqueue_script()
-
I want to use the wp_enqueue_script. Can someone help me out?
I have to do is replaced the :<script src=”<?php echo get_bloginfo(“template_url”); ?>/light/jquery.prettyPhoto.js” type=”text/javascript” charset=”utf-8″></script>
with
<?php wp_enqueue_script( ‘lightbox’ ); ?>
in the head of the header.php file before wp-head()?
Please check my method:
I applied wp_enqueue_script in function.php file
<?php
function my_init_method() {
wp_register_script( ‘lightbox’, ‘wp-content/themes/light/jquery.prettyPhoto.js’);
wp_enqueue_script(‘lightbox’);
}
add_action(‘init’, ‘my_init_method’);
?>Now calling this function from header.php like
<?php wp_enqueue_script(“lightbox”); ?>
but its create issue and stop all scripts working also…
Please help
Regards
Ibrar
The topic ‘how to add wp_enqueue_script()’ is closed to new replies.