Child Theme Not loading x-body-min.js

Good afternoon,
So I needed to make a few customizations to the x-body.js file so I modified it re-minified it and put it in my child theme under /pro-child/framework/js/dist/site/x-body.min.js however it is still taking the x-body.min.js file from the primary theme.

I know for the stacks there are a lot of supplemental files needed to point to the correlating location in the child-theme, are there additional files I need to bring into my child theme to override the main themes x-body.min.js file?

Thank you very much for your time,
Zach

Hey There,

Thanks for writing in! Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own.

What I advise is that you don’t modify the x-body.min.js file, and just write your JS as a separate file and enqueue it to your child theme’s functions.php file.

Thank you for your understanding.

I mean if putting a file inside a child theme in the exact same path as its parent doesn’t yield the use of a file over its parent id say that falls under and issue with the theme.

I know there are some additional files needed to say point to a stack in a child theme and such that fall outside the stacks directory.

Just need to know what to include for it to look past the parent theme.

Hello There,

You need to dequeue the file first and then enqueue the modified files resided in your child theme.
You may use this:

function custom_x_enqueue_site_scripts() {

  wp_dequeue_script('x-site');
  wp_deregister_script('x-site');
  wp_register_script( 'x-site', get_stylesheet_directory_uri() . '/framework/dist/js/site/x-body.min.js', array( 'jquery' ), X_ASSET_REV, true );
  wp_enqueue_script( 'x-site' );

}

add_action( 'wp_enqueue_scripts', 'custom_x_enqueue_site_scripts', 100 );

The use of this code does not guarantee that it will work in the future. This may not load your JS file or cause conflict with other script files or plugin files.

Please also be advised that in the latest release 6.1.5, we no longer use x-body.min.js. We have replaced it and used x.js instead.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.