Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Image upload Jquery conflict
Avatar
Sta
Rookie
Free Members
sp_UserOfflineSmall Offline
Sep 21, 2013 - 4:19 am

Hi,

From reading other posts it appears I have a bootstrap Jquery issue preventing image uploads. Everything works perfectly with Wordpress 2013 theme, so a theme issue rather than a plugin issue.

I've attached the script loading from functions.php, any help in getting bootstrap.js loaded before the wp jquery ui (as you explained in another post) would be gratefully received.

I'm on the latest version of everything and running a child theme setup.

Thx in advance

 

/* LOAD STYLES & SCRIPTS
================================================== */

function sf_enqueue_styles() {

$options = get_option('sf_flexform_options');
$enable_responsive = $options['enable_responsive'];

wp_register_style('bootstrap', SF_LOCAL_PATH . '/css/bootstrap.min.css', array(), NULL, 'screen');
wp_register_style('bootstrap-responsive', SF_LOCAL_PATH . '/css/bootstrap-responsive.min.css', array(), NULL, 'screen');
wp_register_style('fontawesome-css', SF_LOCAL_PATH . '/css/font-awesome.min.css', array(), NULL, 'screen');
wp_register_style('main-css', get_stylesheet_directory_uri() . '/style.css', array(), NULL, 'screen');
wp_register_style('responsive-css', SF_LOCAL_PATH . '/css/responsive.css', array(), NULL, 'screen');

wp_enqueue_style('bootstrap');
wp_enqueue_style('bootstrap-responsive');
wp_enqueue_style('fontawesome-css');
wp_enqueue_style('main-css');

if ($enable_responsive) {
wp_enqueue_style('responsive-css');
}

}

add_action('wp_enqueue_scripts', 'sf_enqueue_styles');

function sf_enqueue_scripts() {

wp_register_script('sf-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', 'jquery', NULL, TRUE);
wp_register_script('sf-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', 'jquery', NULL, TRUE);
wp_register_script('sf-isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js', 'jquery', NULL, TRUE);
wp_register_script('sf-hoverIntent', get_template_directory_uri() . '/js/jquery.hoverIntent.min.js', 'jquery', NULL, TRUE);
wp_register_script('sf-easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', 'jquery', NULL, TRUE);
wp_register_script('sf-carouFredSel', get_template_directory_uri() . '/js/jquery.carouFredSel-6.2.0-packed.js', 'jquery', NULL, TRUE);
wp_register_script('sf-prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', 'jquery', NULL, TRUE);
wp_register_script('sf-viewjs', get_template_directory_uri() . '/js/view.min.js?auto', 'jquery', NULL, TRUE);
wp_register_script('sf-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', 'jquery', NULL , TRUE);
wp_register_script('sf-maps', 'http://maps.google.com/maps/api/js?sensor=false', 'jquery', NULL, TRUE);
wp_register_script('sf-respond', get_template_directory_uri() . '/js/respond.min.js', 'jquery', NULL, TRUE);
wp_register_script('sf-twitter-widgets', '//platform.twitter.com/widgets.js', NULL, NULL, TRUE);
wp_register_script('sf-functions', get_template_directory_uri() . '/js/functions.js', 'jquery', NULL, TRUE);

wp_enqueue_script('jquery');
wp_enqueue_script('sf-bootstrap-js');
wp_enqueue_script('sf-hoverIntent');
wp_enqueue_script('sf-easing');
wp_enqueue_script('sf-flexslider');
wp_enqueue_script('sf-prettyPhoto');
wp_enqueue_script('sf-fitvids');
wp_enqueue_script('sf-respond');

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
if (!is_account_page()) {
wp_enqueue_script('sf-viewjs');
}
} else {
wp_enqueue_script('sf-viewjs');
}

if (!is_admin()) {
wp_enqueue_script('sf-functions');
}

if (is_singular()) {
wp_enqueue_script('comment-reply');
}

}

add_action('wp_enqueue_scripts', 'sf_enqueue_scripts');

function sf_admin_scripts() {
wp_register_script('admin-functions', get_template_directory_uri() . '/js/sf-admin.js', 'jquery', '1.0', TRUE);
wp_enqueue_script('admin-functions');
}
add_action('admin_init', 'sf_admin_scripts');

function sf_load_custom_script() {
global $include_maps, $include_isotope, $include_carousel;

if ($include_maps) {
wp_print_scripts('sf-maps');
}

if ($include_isotope) {
wp_print_scripts('sf-isotope');
}

if ($include_carousel) {
wp_print_scripts('sf-carouFredSel');
}

$options = get_option('sf_flexform_options');

}

add_action('wp_footer', 'sf_load_custom_script');

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 21, 2013 - 10:37 am

yeah the problem is jquery bootstrap conficts with the jquery ui that wp uses/loads... wp uses in the admin so unless another plugin uses it on the front end, like simple press, some themes get away with stomping on the wp version...

the key is to get bootstrap to load before jquery ui...

so try changing

wp_enqueue_script('jquery');
wp_enqueue_script('sf-bootstrap-js');

to

wp_enqueue_script('jquery');
wp_enqueue_script('sf-bootstrap-js');
wp_deregister_script( 'jquery-ui' );
wp_register_script( 'jquery-ui-core', '/wp-includes/js/jquery/ui/jquery.ui.core.min.js', array('jquery, bootstrap'), '', 1 );
wp_enqueue_script('jquery-ui');

Avatar
Sta
Rookie
Free Members
sp_UserOfflineSmall Offline
Sep 22, 2013 - 2:51 am

Thanks for the quick reply. Tried in both the child and main theme and didn't work unfortunately. Anything else I could try?

 

 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 22, 2013 - 12:38 pm

didnt work?  what does that mean?  did you check the load order?  looking at your page source in browser, was bootstrap loaded before jquery ui??

wp_deregister_script( 'jquery-ui' );

should be

wp_deregister_script( 'jquery-ui-core' );

Avatar
Sta
Rookie
Free Members
sp_UserOfflineSmall Offline
Sep 28, 2013 - 3:54 am

Hi, apologies for late reply - hectic week.

I made the changes in functions php and the first reference to JQuery when viewing source is:

/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>

Now in the forum the 'Add reply' button doesn't work (get hover effect but doesn't click).

Edit reply button works, but then 'smileys', 'attachments' and 'preview' buttons don't work (again hover effect shows but not clickable)

 

 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 28, 2013 - 4:23 am

How about a link to the forum page?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Sta
Rookie
Free Members
sp_UserOfflineSmall Offline
Sep 30, 2013 - 8:59 am

hi, there's a theme update scheduled and have just updated to the latest version of simple press. I'm off work now for a week...let me play around with things and I'll get back to you with details (I'm new to SP so will give me a chance to consolidate any other queries at the same time ;)

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 30, 2013 - 2:27 pm

okay, we will be here...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17363
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625