Add custom JS to yootheme

The configuration file /layouts/theme.config.php initializes all PHP classes and loads the necessary JavaScript. If you need to load custom JavaScript files, this is the place to do it. Enabled compression and Data URI will be applied automatically to all files you add here.
  • Create a new file /styles/STYLE-NAME/layouts/theme.config.php
  • Load the original file through PHP by using the require function.
  • Then add your JavaScript file to the asset collection, so it will be added automatically to the template header.
  • Put your own custom JavaScript file in the /styles/STYLE-NAME/js/MY-JS.js directory.
How will you file look like /styles/STYLE-NAME/layouts/theme.config.php <?php require(__DIR__.’/../../../layouts/theme.config.php’); // add script $this[‘asset’]->addFile(‘js’, ‘js:MY-JS.js’); So if we were to add sticky.js that  you can download here best would  be if yootheme could provide these somewhere within the warp and be able to call them when needed but they dont 🙁 if you add custom sticky functionality your /styles/STYLE-NAME/layouts/theme.config.php would look like this <?php require(__DIR__.’/../../../layouts/theme.config.php’); // add script $this[‘asset’]->addFile(‘js’, ‘js:sticky.js’); and you stule should look like this custom-js You can always contact us to help you if this is hard to do the more work we have the less we will charge 🙂

custom js, smoothscroll, sticky, yootheme smoothscroll, yootheme sticky


Nemanja Radevic

Wordpress expert Joomla expert Front end development expert Warp Framework expert Responsive design

© Radevic Team. All rights reserved. Powered by YOOtheme.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.