From my point of view, this should be working. Maybe you can post your custom.js file here. It could be possible that this file has a syntax error or something similar. You could also test if the built-in jquery is working out of the box by adding a simple jquery-command in your header.php.
Some hints:
-
The action-hook
template_redirect
is used to include the file only on the front-page (so i can remeber). If you want to load the script after the theme is loaded, you can use theafter_setup_theme
action-hook. -
You don’t have to enqueue your jquery file manually, if you set jquery as a dependancy of your custom.js, like you did. The file will automatically be loaded from WordPress before your custom.js is attached.
-
Do you have added the
jQuery.noConflict();
at the beginning of your custom.js?
Some working example:
functions.php
function twentyten_custom_scripts() {
if ( !is_admin() ) // instruction to only load if it is not the admin area
{
wp_register_script('custom_script', get_bloginfo('template_directory') . '/scripts/custom.js', array('jquery') );
wp_enqueue_script('custom_script');
}
}
add_action('after_setup_theme', 'twentyten_custom_scripts');
custom.js
jQuery.noConflict();
jQuery(document).ready(function() {
// do your stuff e.g.
jQuery("a[rel^='prettyPhoto']").prettyPhoto();
});