Monday, 19 August 2013

jQuery plugin not loading in WordPress

jQuery plugin not loading in WordPress

I've successfully linked jQuery to WordPress within the functions.php.
However, it appears that the center.js is not loading. I say this, because
the console is giving me this error: Uncaught TypeError: Object [object
Object] has no method 'center'
I am calling all scripts with <?php wp_head(); ?> within the header.php.
Here is my functions.php:
<?php
function add_google_jquery() {
if ( !is_admin() ) {
wp_deregister_script('jquery');
wp_register_script('jquery',
("http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"),
false);
wp_enqueue_script('jquery');
}
}
add_action('wp_print_scripts ', 'add_google_jquery');
// just added jQuery
function add_google_center() {
if ( !is_admin() ) {
wp_register_script('center',
("http://jquerydevbrazil.googlecode.com/svn/trunk/jquery.center.js"),
false);
wp_enqueue_script('center');
}
}
add_action('wp_print_scripts_center ', 'add_google_center');
set_post_thumbnail_size( 800, 600, 1 );
function PA_stylesheet() {
wp_enqueue_style( 'pa-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'PA_stylesheet' );
function PA_javascript() {
wp_enqueue_script( 'custom-script',
get_stylesheet_directory_uri() . '/tran.js',
array( 'jquery' )
);
}
add_action( 'wp_enqueue_scripts', 'PA_javascript' );
?>
Would anyone be able to help solve this problem?

No comments:

Post a Comment