- Web templates
- E-commerce Templates
- Loaded Commerce
- E-Commerce Comparison
- E-commerce Comparison: Payment and Shipping methods
- E-commerce templates compatibility table
- CMS & Blog Templates
- CMS Comparison
- CMS templates versions compatibility
- Facebook Templates
- Website Builders
WordPress Cherry 3.x. How to include custom JS file
August 10, 2015
In this tutorial you will learn the way to include a custom JS file to Cherry Framework 3 based theme.
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:
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' );
Save the changes in the file.
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:
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: