Skip to content

Instantly share code, notes, and snippets.

@asimpson
Created August 7, 2012 21:12
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 asimpson/3289411 to your computer and use it in GitHub Desktop.
Save asimpson/3289411 to your computer and use it in GitHub Desktop.
The proper way to include a script/stylesheet in Wordpress functions.php - wrote this to call from ST2 via fetch
<?php
function adam_load_scripts(){
wp_register_script( 'handle', get_template_directory_uri()."path", array('dep'), 'ver', 'footer?');
//to add a stylesheet, change all script to style except wp_enqueue_script
//wp_register_style( 'handle', get_template_directory_uri()."path", array('dep'), 'ver', 'media')
wp_enqueue_script('handle');
}
add_action('wp_enqueue_scripts', 'adam_load_scripts');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment