-
AuthorPosts
-
July 27, 2018 at 7:56 pm #990826
Hello,
I have a counter on my homepage, developed by a friend and each time I update the theme, I have to do this :
– add comerso.js file in Enfold / js
– add this code at the bottom of footer.php<div id="fb-root"></div> <script src="/wp-content/themes/enfold/js/comerso.js" type="text/javascript"></script> </body>Today, I’ve created a child theme.
Do I have to create a js folder to put my comerso.js file?
And to change footer.php, how can I add my code at the bottom, but getting the update of the rest of the file?Tx for your help! I give you all the credentials below.
MarineJuly 28, 2018 at 5:42 pm #990943Hey newki75,
Please add your comerso.js file in a js folder in your child theme, then enqueue it by adding this script to your child theme functions.php:// Register and enqueue scripts function my_custom_scripts() { wp_enqueue_script( 'comerso', get_stylesheet_directory_uri() . '/js/comerso.js', array( 'jquery' ) ); } add_action( 'wp_enqueue_scripts', 'my_custom_scripts' );it will then be loaded with your site in the footer.
You can read more about it here: How to add Custom JS or PHP ScriptBest regards,
MikeJuly 28, 2018 at 5:43 pm #990944Tx Mike. So I can remove this code from my footer.php file?
<div id="fb-root"></div> <script src="/wp-content/themes/enfold/js/comerso.js" type="text/javascript"></script> </body>Tx for your help!
July 28, 2018 at 7:42 pm #990958Hi,
Yes you can remove it as it will be loaded with the new function.Best regards,
MikeJuly 29, 2018 at 10:31 am #991032Tx Mike, it works perfectly :-)
My updates will be easier / quicker now.
Have a nice day, you can close the issue :-)
(Enfold is definitely my favorite theme, better than Avada ! with a great support)July 29, 2018 at 5:06 pm #991101Hi,
Glad we were able to help, we will close this now. Thank you for using Enfold.For your information, you can take a look at Enfold documentation here
For any other questions or issues, feel free to start new threads under Enfold sub forum and we will gladly try to help you :)Best regards,
Mike -
AuthorPosts
- The topic ‘Add js file and change footer.php in my child theme’ is closed to new replies.
