The way I did it was to re-register the JS in the child functions.php file
`wp_deregister_script( ‘dtheme-ajax-js’);
wp_enqueue_script( ‘dtheme-ajax-js’, get_bloginfo(‘stylesheet_directory’) . ‘/_inc/global.js’, array( ‘jquery’ ), $version );`
thanks for the kind response. that makes sense. I will try your way.
Mr Brainz, i have just tested it. It works! Thanks again.
Do you happen to know how to override bp-default/_inc/ajax.php in child theme?
It’s not recommended to override /_inc/ajax.php, is there a specific reason why you’d want to do that? There are hooks in /_inc/ajax.php that you can use to add functionality.
If you need to override both ajax.php and the JS, you might as well create your own parent theme instead of creating a child theme of bp-default.
hi ray, thanks for the post. I tried to use hooks in /_inc/ajax.php, but it didn’t seem to work in my case. Here is what I would like to achieve:
When an activity post is DELETED, an image will be automatically updated right below the group admin avatar.
I added some code in /_inc/ajax.php, pass on the new image url by json. In /_inc/global.js, when the “delete_activity” action is fired, the new image url is returned as response. Then show the new image. The code at /_inc/global.js is like: jq(‘#myimage’).attr(“src”, new_image_url);
If it is not recommended to override /_inc/ajax.php, is there a better way to do so? Thanks again.