First of all, to resolve the javascript conflict I’ve set up a simple tl_custom.js
under my theme js/
folder, with the following code
jQuery(document).ready(function($) {
// Remove handler set by themes/Divi/js/custom.js at line 2642
$( 'a[href*=#]:not([href=#])' ).off();
});
Then I add the script with the following code in functions.php
function tl_custom_scripts() {
if ( ! is_admin() ) {
$scriptsrc = get_stylesheet_directory_uri() . '/js/';
wp_register_script( 'tl_custom', $scriptsrc . 'tl_custom.js', '', '', true );
wp_enqueue_script( 'tl_custom' );
}
}
add_action( 'wp_enqueue_scripts', 'tl_custom_scripts', 20 );
The main problem is that the parent theme register custom.js
in the footer, so I had to set the wp_register_script last parameter to true
and then set add_action priority to 20.
Related Posts:
- Search user metadata with checkboxes via ajax (almost working)
- wp_enqueue JavaScript in child-theme (ReferenceError) using Search & Go
- Scripts not appending to element in AJAX call – why?
- How to search using ajax for exact phrase or words in an input field?
- Ajax in plugin fails – but only on one blog – no idea why
- How to add javascript code into Divi child theme?
- Multiple Notifications SetInterval
- admin-ajax.php & my wp-admin folder url showing in header
- wordpress ajax is not working for dropdown selection
- Automatic add space if user enters number(any digit)
- Why wp_ajax hooks doesn’t work?
- iOS and ajaxComplete
- How to customize the_archive_title()?
- Ajax call always returns 0
- Child theme – Overriding ‘require_once’ in functions.php
- Redeclare a function in a child theme
- How to override a function when isn’t at functions.php
- Where and how to put inline js in pages
- ajax live search for post title
- syntax for remove_filter in parent theme with class
- Overriding core functions in child theme
- Override parent theme function that is not hooked or in the functions.php file
- Reuse variable in hook callback
- Child theme – copied some files from parent to child website still uses parent files
- Using email_exists() wp function in an ajax request
- Run Product Filter Javascript On Page Template
- add sidebar area to header of child theme
- Understanding WordPress child theme custom JS loading
- How to update BuddyPress xprofile fields programmatically? [closed]
- Display a function using AJAX
- Overriding methods in a child theme
- Should I ask a theme developer to use locate_template rather than require_once
- How can I add an image field to BuddyPress Extended Profile Fields? [closed]
- Using the child theme functions.php to change the customizer.php on parent theme
- Click loads template via ajax
- Overwrite Parent Theme add_image_size in Child Theme
- jquery won’t load in footer
- Twenty Eleven Child theme error when attempting to use a rewritten function
- How to properly add NPM packages and integrate them in WordPress?
- How to make child theme inherit parent custom theme options [closed]
- Replace menu links with # and add name to its li
- Ajax not working properly
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- Search filter by Post title OR Meta Title Value [duplicate]
- Why is functions.php file in child not initializing and over-writing parent?
- dynamic dependent select dropdown
- Including a specific Javascript Script in a template. Is my code correct?
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- Add custom function to a theme with child theme’s functions.php
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- I have problems with loading javascripts
- Enqueuing latest version of jQuery into a child theme returns a blank screen
- echo custom fields with AJAX
- Adding javascript to functions.php causes problems with my template
- Return child theme url
- How do I change a parent theme’s function through the child theme?
- javascript and css links not working on sever
- Can’t locate custom image sizes defined by child theme
- Add back in child theme what the parent theme removed with remove_action
- Can’t switch to a child theme using filters template, option_template and option_stylesheet
- How to include any template using Shortcode fuction?
- Check if a value exists in database table
- Javascript not loading after the document ready
- overwrite code snippet from parent to child theme
- Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme
- How to use get_posts() function in functions.php
- Are innerHTML elements visible to jQuery functions?
- How do I pull avatar from post using BuddyPress? [closed]
- Child theme functions.php
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Creating multiple category drop down
- Get webpack to work on child theme
- how can I add filter in specfic field in my website?
- How to remove font awesome from loading in wp theme
- Add custom css file after plugin css with WordPress Child Theme functions.php
- Running javascript without hooking wp_head
- Widget is displayed in two places
- Update $wpdb query with AJAX
- Changing the default view of “The Events Calendar” for mobile
- How to use `foreach()` in ajax call
- Change default color scheme in twentyfifteen child theme?
- Create New User Custom Field not Saving
- Changing author links on homepage to buddypress profiles – without affecting ability to link to author archive throughout the site
- WordPress Ajaxifying not working properly
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Get child-pages slugs of current page into js-file
- Some code is added automatically to my site’s header – what is it?
- same get_posts function works diffrently in tag.php and functions.php
- Getting back a blank WordPress site following functions code edit
- Adding a meta box fields to child theme options page
- functions.php filters not applied in AJAX call
- Pass max posts to Javascript
- Blank child theme – functions.php problem
- admin-ajax.php nulls all php variables
- How do I get my nav menu to show sub pages?
- Why functions metaboxes is causing White Screen in Admin [closed]
- How do I make my child theme’s CSS update when I save it?
- Get all users from role and add to dropdown (select) – wordpress, javascript
- How can I use AJAX in child theme template?
- WordPress enque the same script causes the setInterval not to work