If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

WordPress Cherry 3.x. How to include custom JS file

In this tutorial you will learn the way to include a custom JS file to Cherry Framework 3 based theme.

WordPress Cherry 3.x. How to include custom JS file

If you need to add a custom JS script to your template, you should not edit Cherry Framework 3 JS files, because your changes will be overwritten after the Cherry Framework 3 update.

Some Cherry Framework 3 based templates include my_script.js or custom.js files in the js folder of the child theme. If your template does not have such files, you can include a custom JS file manually. To do it, perform the following steps:

  1. Connect to your FTP or open File Manager in the Hosting Control Panel. Open custom-function.php file from wp-content/themes/themeXXXXX/includes directory, where XXXX is the number of your theme. And add the following script to this file after the opening tag <?php:

    wp_enqueue_script( 'custom-scripts', get_stylesheet_directory_uri().'/js/custom.js', array('jquery'), '1.0' );
    

    custom_js_file

    Save the changes in the file.

  2. Then upload a new my_script.js file to wp-content/themes/themeXXXXX/js directory on your server (you should create js folder in the child theme directory, if you don’t have it).

    New JS file can be created via File Manager in the Hosting Control Panel (see the screenshot below) or with any code editor or via Hosting Control Panel. This video tutorial will show you how to create a new JS file with Notepad:

    custom_js_file2

Now you can add your custom JS script to my_script.js file. Don’t forget to save the changes after editing the file.

This is the end of the tutorial. Now you know how to include a custom JS file to Cherry Framework 3 based theme.

Feel free to check the detailed video tutorial below:

WordPress Cherry 3.x. How to include custom JS file