Problem with Call Custom file

Open
REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme May 06, 2024
Login to reply
Rickey Miller
3 months ago

The issue occurs because you're using get_template_directory_uri(), which points to the parent theme's directory. Since you're working with a child theme, you should use get_stylesheet_directory_uri() instead, which points to the child theme's directory.

wp_enqueue_script( 'custom-js', get_stylesheet_directory_uri() . '/js/footerhide.js', array('jquery'), null, true );

get_template_directory_uri(): Points to the parent theme directory.

get_stylesheet_directory_uri(): Points to the child theme directory.

Replace your wp_enqueue_script line with the corrected version, and your script should now load from the child theme's js folder.







Snow Rider

Atiq Rev
10 months ago

Hi,

I have made a file on child theme js folder which

i call this file like this--  wp_enqueue_script( 'custom-js', get_template_directory_uri() . '/js/footerhide.js', array('jquery'), null, true );

But when i visit page showing this error--  https://woocommerce-1187255-4349440.cloudwaysapps.com/wp-content/themes/rehub-theme/js/footerhide.js


which is call direct theme not child theme.

can you please help me to fix it.


thank you

Additional Info

Link on page with issue: https://woocommerce-1187255-4349440.cloudwaysapps.com