php - jQuery plugin not loading in WordPress -
i've linked jquery wordpress within functions.php
. however, appears center.js
not loading. this, because console giving me error: uncaught typeerror: object [object object] has no method 'center'
i calling scripts <?php wp_head(); ?>
within header.php
. here 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'); // 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 able solve problem?
you shouldn't using wp_print_scripts. use wp_enqueue_scripts instead.
http://codex.wordpress.org/plugin_api/action_reference/wp_print_scripts
(this tying in add_google_jquery , add_google_center functions)
so, need replace 'wp_print_scripts' 'wp_enqueue_scripts' , should go
Comments
Post a Comment