Note: We do not provide support for custom code or scripts.
You can add Javascript or jQuery code to your site globally or on a page-by-page basis through a Code module.
Adding JavaScript globally
You can add Javascript or jQuery code globally under Customize > Advanced > Custom Javascript.
Note: You do NOT need to add <script> tags when placing JavaScript in our global editor.
Adding JavaScript in a Code Module
You can place Javascript to run individually on a page with the use of a Code Module. To do so, just drag a Code module on the page and paste in your script.
Note: When placing code in a Code module, you DO need to wrap your scripts in <script></script> tags.
FAQ
Will custom JS be overwritten when updating Semplice?
Customizations added in the Semplice backend will never be erased or overwritten when updating your Semplice theme. The only time modifications will be overwritten is if you've modified core Semplice site files without creating a child theme first.
Troubleshooting
Scripts only firing once or only after page refresh
This can happen if you have Single App mode enabled under Semplice > Settings. Because Single App mode is a seamless site experience, scripts will not be loaded with every page load if placed globally.
To ensure scripts fire on each page load with Single App mode enabled, place your scripts in a Code module. You can place these Code modules in a global footer if you want the scripts to load on every page.
Alternatively, you can also wrap your code placed under Customize > Advanced > Custom JS in the following script to ensure it fires on each page transition load:
window.addEventListener('sempliceTransitionInDone', function (e) {
// your code
}, false);
Scripts not working or $ code error
With the latest version of Wordpress, if you are using '$' in your JavaScript code this will lead to an error. To resolve, you will need to instead replace all '$' with 'jQuery' in your code.
If your code currently starts with:
$(document).ready(function() {
It will need to instead be wrapped in:
(function($) {
// your code
})(jQuery);