Loading Javascript Libraries in Wordpress generated page


/ Published in: PHP
Save to your folder(s)

Load jQuery into WordPress generated pages, the wp_enqueue_script function can be used in plugins as well. OR Add and load a new script that depends on jQuery (this will also cause it to load jQuery into the page as well).


Copy this code and paste it in your HTML
  1. <?php wp_enqueue_script('jquery'); ?>
  2.  
  3. <?php wp_enqueue_script('jquery'); ?>
  4.  
  5.  
  6.  
  7. <?php wp_enqueue_script('newscript','/wp-content/plugins/someplugin/js/newscript.js',array('jquery'),'1.0' ); ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.