I found Morris.js to be a delightfully implemented charting script, and wanted to include it in my Wordpress installation. But I have never included a js file with my blog before, and would appreciate if someone can guide me on this:

  1. How do I include the javascript file?
  2. Where do I upload it on the server?
  3. Anything else I need to know to use it?


1 Answer 1


Create js folder in your theme directory then save Morris.js into it. it is not mandatory to store it in js folder you can store it anywhere else but i recommend to do it to seprate javascipt files from other files.

Add follwing action into functions.php file

function custom_scripts() {
/* Include Scripts */
wp_enqueue_script( 'morris-script', get_template_directory_uri() . '/js/Morris.js', array( 'jquery' ), '', true );
add_action( 'wp_enqueue_scripts', 'custom_scripts' );

You can find more information about wp_enqueue_script() function from this link http://codex.wordpress.org/Function_Reference/wp_enqueue_script of wordpress codex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.