Created
November 30, 2010 20:45
-
-
Save slambert/722369 to your computer and use it in GitHub Desktop.
Excerpt of functions.php for calling a Javascript file in your wordpress theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////// | |
// Add custom jQuery plugins and functions // | |
///////////////////////////////////////////// | |
function aaathematic_scripts() { // name the function something unique to your theme | |
if ( !is_admin() ) { // instruction to only load if it is not the admin area | |
wp_enqueue_script('sample_js_file', get_bloginfo('stylesheet_directory') . '/js/aaathematic_scripts.js', array('jquery'), '20100329' ); | |
// the above line includes the name of the file, where the file is in relation to the stylesheet directory, specifying that you're using jQuery and a version number for your file | |
} | |
} | |
add_action('init', 'aaathematic_scripts'); // be sure to use the same function name that you did above! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $j = jQuery.noConflict(); | |
/* | |
This makes a selector/div fade in. | |
This works, but in your style.css file, the selector/div has to be set to 'visibility:none' | |
*/ | |
$j(document).ready(function () {; | |
$j('#content').hide() | |
$j('#content').fadeIn(2000); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment