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 can I change a function in a parent theme via a child themes functions.php
- How to limit character length in BuddyPress function output [closed]
- Twentyten Child Theme: header images display messed up in admin panel
- WP Ajax Function Always Returning undefined
- call of javascript function to external url always blocked by cors
- 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
- admin-ajax.php + load-scripts.php hanging for minutes
- Including a specific Javascript Script in a template. Is my code correct?
- How to know which ajax file or function is called for action
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- how to en-queue jQuery to load before the tag
- Overwriting the menu break points of twentysixteen in child theme
- Reuse variable in hook callback
- Automatically include all php files in a child theme directory
- Multisite Ajax serialize return error [object Object]
- How do I remove the date and category form my portfolio pages
- Override the function twentytwelve_scripts_styles in a child theme
- I can’t enqueue my scripts – They literally aren’t being added to my site
- Add custom function to a theme with child theme’s functions.php
- Pagination in relation to archive.php
- Create post using Ajax
- Skeleton Child Theme Add Icon Bar to Header Flex Grid
- How to load parent theme template parts in child theme
- WordPress listen to $_POST in functions.php
- Javascript function not working when placed in Text Block
- Load Post into DIV with Ajax
- wordpress use single ajax in place of multiple ajax requests in a smarter way
- How to set the default avatar of buddypress avatar [closed]
- Running script based on Category
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- AJAX error handling for submit function in functions file
- I have problems with loading javascripts
- Enqueuing latest version of jQuery into a child theme returns a blank screen
- Load custom css in functions.php causing library issue
- echo custom fields with AJAX
- Not all CSS elements transferring via parent to child?
- Adding javascript to functions.php causes problems with my template
- Return child theme url
- Got white blank page after copying the functions.php to child theme
- How do I change a parent theme’s function through the child theme?
- How to edit classes in body tag?
- javascript and css links not working on sever
- Run a jquery script on on a certain template page
- How to get specific string/value from an array? php [closed]
- Can’t locate custom image sizes defined by child theme
- Randomizing wp_tag_cloud() in child theme
- PHP 7.1 | Warning: A non-numeric value encountered in
- 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
- Loading two different AJAX requests on two different pages
- Where do I go to edit this area? [closed]
- Enable right click on WordPress site
- How to include any template using Shortcode fuction?
- Why i can’t get custom fields value or post ID via Ajax?
- Check if a value exists in database table
- Parent theme styles overriding child theme CSS [closed]
- The correct way to add a JavaScript in the functions.php [closed]
- Javascript not loading after the document ready
- Theme JS is available but theme CSS isn’t
- processing form data with ajax
- Hide tab Buddypress profile for visitors, not logged in users
- overwrite code snippet from parent to child theme
- Unable to point the child theme directory even using get_stylesheet_directory()
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- How to edit/replace Parent functions.php function in Child Theme to add “Walker” class
- Need help with customalert that it would read on a normal page, but not in WordPress
- Child theme function.php causes fatal error
- How to load jQuery in TOP of wp_footer?
- get_template_directory_uri() links to child theme not parent
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- How to remove admin footer text from inside child theme?
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Email Exists ERROR into Ajax registration form
- How to overwrite template.php file
- remove_action not working, even after changing priority [duplicate]
- Solution dealing with Child Theme / Parent theme functions
- 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
- How to use parent theme functions in child theme functions.php file?
- Are innerHTML elements visible to jQuery functions?
- Removing parent theme CSS without editing parent theme
- How to override this theme function in child theme
- Include Jquery libraries in wordpress theme?
- get_template_directory() – references parent theme directory
- Ajax resetting my global variable