I've built a child theme of Divi Theme to use with Buddypress. So far so good, except for a script conflict on commenting buttons.
The theme load a javascript (js/custom.js
at 2642:2662) with the following function:
$( 'a[href*=#]:not([href=#])' ).click( function() { if ( $(this).closest( '.woocommerce-tabs' ).length && $(this).closest( '.tabs' ).length ) { return false; } if ( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname ) { var target = $( this.hash ); target = target.length ? target : $( '[name=' + this.hash.slice(1) +']' ); if ( target.length ) { et_pb_smooth_scroll( target, false, 800 ); if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) { setTimeout(function(){ et_pb_smooth_scroll( target, false, 200); }, 500 ); } return false; } } });
This event target the same button that Buddypress use for commenting, preventing AJAX form from loading on click.
I don't want to edit the parent theme (custom.js). How can I prevent this conflict? Is there a workaround, maybe from functions.php?
UPDATE
Using wp_dequeue_script to load that script later, didn't work. When using this code in functions.php
function de_script() { wp_dequeue_script( 'divi-custom-script' ); } add_action( 'wp_print_scripts', 'de_script', 100 );
then the full script (custom.js) was not loaded at all.