Skip to content

Instantly share code, notes, and snippets.

@kopepasah
Created March 25, 2014 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kopepasah/9765764 to your computer and use it in GitHub Desktop.
Save kopepasah/9765764 to your computer and use it in GitHub Desktop.
<?php
// Enqueuing and Using Custom Javascript/jQuery
function custom_load_custom_scripts() {
if ( file_exists( get_stylesheet_directory() . '/js/custom_jquery_additions.js' ) ) {
$url = get_stylesheet_directory_uri() . '/js/custom_jquery_additions.js';
} else if ( file_exists( get_template_directory() . '/js/custom_jquery_additions.js' ) ) {
$url = get_template_directory_uri() . '/js/custom_jquery_additions.js';
}
if ( ! empty( $url ) ) {
wp_enqueue_script( 'custom_jquery_additions', $url, array('jquery'), false, true );
wp_enqueue_script( 'jquery-masonry', array( 'jquery' ) );
}
}
add_action( 'wp_enqueue_scripts', 'custom_load_custom_scripts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment