[WP] Slider looks correctly in preview, but when I add it to site it doesn't work
Reasons why slider may not work when you embed it to your theme:
To check if this is your issue, simply go to RoyalSlider Global Settings page and enable checkbox that will load slider files on all pages. If after enabling checkbox CSS and JS files are still not included, check issue #5 in this list. More about including JS & CSS files.
2. You have two jQuery.js scripts on one page
This issue is caused when your theme or one of your plugins adds jQuery directly with a script tag. jQuery in WordPress should be added only with
<?php wp_enqueue_script('jquery'); ?>.
You need to find
<script> tag that adds jQuery, most likely it's in header.php or footer.php of your theme, but can be anywhere. And replace with
<?php wp_enqueue_script('jquery'); ?>
Usually inproper script tag looks something like:
3. You have old (or non-default) version of jQuery
This issue is caused when your theme or one of your plugins deregisters default jQuery script using
wp_deregister_script('jquery') and adds own. If error like:
To fix this find where your theme or one of your plugins deregisters jQuery and leave just wp_enqueue_script part, or simply change path to newer version of jQuery. Deregistering of script usually looks something like this:
and should be replace just with:
The easiest way to find this part of code is to just download theme or plugins folder that causes the issue and do a bulk search through its files.
Learn more: Why Loading Your Own jQuery is Irresponsible?
If error comes from RoyalSlider script:
- Error like
Object has no method 'on'means that old jQuery script is used. Check section #3 in this aticle.
- Error like
Object has no method 'royalSlider'means that slider script is not included or you have two scripts on one page, check section #1 or #2.
- If any other error appears, please open support ticket and provide link to page with problem slider.
5. Your theme is missing wp_head() or wp_footer() call
If you use theme from trusted providers or you use default twenty* theme and you haven't modified code - 99% this is not your issue. wp_head() should be added in header, wp_footer() in footer, check WordPress codex for more info.
To find what's causing the issue
- Deactivate all other plugins
- Switch to default theme
- Check if RoyalSlider now works correctly, if it doesn't - open private support ticket and provide admin access.
- Switch to your theme and start activating your plugins one by one to see which one causes the issue.
Side noteAll issues above are caused third party themes and plugins that don't comply WordPress coding standards. If you've found the issue, contact the developer of that theme or plugin.
If you have problems figuring out this by yourself, please open a support ticket and send a link to page with broken RoyalSlider and I'll tell you what causes your issue.