Snippets

Jan Pozivil Include custom JS in WP

Created by Jan Pozivil last modified
jQuery.noConflict();
var Modul = (function($, w) //shortcuts $=jQuery, w=window
{
  var APP = {
    init: function()
    {
      //start methods within APP
    }
  };
  $(document).ready(function()
  {
    APP.init();
  });
})(jQuery, window, undefined);
1
2
3
4
5
6
7
8
<?php
  function theme_custom_scripts()
  {
    wp_register_script('functions-js', get_stylesheet_directory_uri().'/functions.js', array('jquery'), false, true);
    wp_enqueue_script('functions-js');
  }
  add_action( 'wp_enqueue_scripts', 'theme_custom_scripts' );
?>

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.