Categories

Featured templates

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

Amina Freinger August 10, 2015
Rating: 5.0. From 1 vote.
Please wait...

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

Wordpress Web Templates
This entry was posted in WordPress Tutorials and tagged Cherry, custom, file, js, WordPress. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket

Live Chat
We help you to choose the right product.