0

I have no idea why all plugins, which are based on Jquery, are not working properly in my wordpress theme. For instance, toggle plugin or dw questions.

This is how I do connect my scripts in theme:

In header

<?php wp_enqueue_script("jquery"); ?>
<?php wp_head(); ?>

In functions:

add_action('wp_enqueue_scripts', 'no_more_jquery');

function no_more_jquery(){
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . 
($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . 
"://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js", false, null);
wp_enqueue_script('jquery');

if ( !is_admin() ) {
function easing()
{

 wp_register_script( 'jquery_easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array( 'jquery' ) );

wp_enqueue_script( 'jquery_easing' );
}
add_action( 'wp_enqueue_scripts', 'easing' );
function camera()
{
// Register the script like this for a theme:
wp_register_script( 'camera_min', get_template_directory_uri() . '/js/camera.min.js', array( 'jquery' ) );

wp_enqueue_script( 'camera_min' );
}
add_action( 'wp_enqueue_scripts', 'camera' );
function jquery_ui()
{

wp_register_script( 'jquery_ui-script', get_template_directory_uri() . '/js/jquery-ui-1.9.0.custom.min.js', array( 'jquery' ) );

wp_enqueue_script( 'jquery_ui-script' );
}
add_action( 'wp_enqueue_scripts', 'jquery_ui' );
function fadeSlideShow()
{
// Register the script like this for a theme:
wp_register_script( 'fadeSlideShow-script', get_template_directory_uri() . '/js/fadeSlideShow.js', array( 'jquery' ) );

wp_enqueue_script( 'fadeSlideShow-script' );
}
add_action( 'wp_enqueue_scripts', 'fadeSlideShow' );
}
}
Wildpixel
  • 3
  • 2
  • Because you're dequeueing the default WordPress version of jQuery...and those plugins depend on it. Why are you doing that? – rnevius Mar 27 '15 at 08:08
  • Be sure to check that the $-sign of jQuery is working properly. Some wordpress plugins just assume $ is working on a Wordpress site. https://api.jquery.com/jquery.noconflict/ – Erwin Mar 27 '15 at 08:19
  • well, some of my scripts use last version of Jquery, thats why I deregister the default version 1.0 by online version, but how it influences on plugins I dont get – Wildpixel Mar 27 '15 at 08:23
  • Because those plugins require the included WP jQuery as dependencies... – rnevius Mar 27 '15 at 08:24
  • ok, right now I have installed plugin wp_jquery, updated default verstion of wordpress jquery to last. Removed all script in function regarding jquery, and in header just keep wp_head, jquery works on my site well, but still problem with plugins((((((((((( – Wildpixel Mar 27 '15 at 08:53

0 Answers0