Home › Forums › Back End › Jquery WP issue › Re: Jquery WP issue
I can not get it working with your method. It only happens every other reload or clearing of the cache. With the following code, it works perfect the first try and every try after… So Not sure whats going on.
if (!is_admin()) add_action(“wp_enqueue_scripts”, “my_jquery_enqueue”, 11);
function my_jquery_enqueue() {
wp_deregister_script(‘jquery’);
wp_register_script(‘jquery’, “//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js”, false, null);
wp_enqueue_script(‘jquery’);
}
if (!is_admin()) add_action(“wp_enqueue_scripts”, “my_jquery_ui_enqueue”, 11);
function my_jquery_ui_enqueue() {
wp_deregister_script(‘jqueryui’);
wp_register_script(‘jqueryui’, “//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js”, false, null);
wp_enqueue_script(‘jqueryui’);
}
function portfolio_script_manager() {
// wp_register_script template ( $handle, $src, $deps, $ver, $in_footer );
wp_register_script(‘portfolio-scroll-bar’, get_template_directory_uri() . ‘/js/jquery.mCustomScrollbar.js’, array(‘jquery’), true, true);
wp_register_script(‘portfolio-mouse-scroll’, get_template_directory_uri() . ‘/js/jquery.mousewheel.min.js’, array(‘jquery’), true, true);
wp_register_script(‘portfolio-sticky’, get_template_directory_uri() . ‘/js/jquery.sticky.js’, array(‘jquery’), true, true);
// custom scripts (added)
wp_enqueue_script(‘portfolio-scroll-bar’);
wp_enqueue_script(‘portfolio-mouse-scroll’);
wp_enqueue_script(‘portfolio-sticky’);
}
add_action(‘wp_enqueue_scripts’, ‘portfolio_script_manager’);
It’s just every time I try to enqueue jquery and the UI from inside the function using the other method, nothing really works. It will show in my resources that they are loaded, but doesn’t do much past that.