Home › Forums › Pro Support › carousel not showing on mobiles when wprocket mobile cache is on
Tagged: carousel wprocket caching
- This topic has 12 replies, 3 voices, and was last updated 3 years, 1 month ago by
Tom.
-
AuthorPosts
-
October 27, 2020 at 10:22 am #21736
Carlo
ParticipantHi there,
I have a carousel (with automatic switching) in the home page.On PCs it’s working fine.
On mobile, the carousel is simply blank. (see link: https://pbcwebinar.it. It must be tested on a real mobile device, simulating a mobile device does not replicate the issue).
If I switch mobile caching in wp rocket, the carousel works.I tried putting /wp-content/plugins/wp-show-posts-pro/modules/carousel/slick/slick-min.js in the “Excluded JavaScript Files” window in wp rocket as suggested in another thread with no success.
How can I fix it? I’d like to keep mobile caching on.
Thank you. Best wishes.
October 27, 2020 at 10:31 am #21739Carlo
ParticipantSorry, a word is missing, I meant:
If I switch OFF mobile caching in wp rocket, the carousel works.October 28, 2020 at 3:27 am #21800Carlo
Participantupdate: it does not work on PCs either.
Waiting forward for your support. Thank you. Carlo
October 28, 2020 at 1:40 pm #21822Tom
KeymasterHi there,
I believe the issue here is the scripts are being deferred, so the inline javascript that is required for the carousel is causing an error.
There is no need to defer these scripts in the footer, as they’re already in the footer of the website. Is it possible to exclude certain scripts from being deferred?
October 29, 2020 at 1:35 am #21858Michal
ParticipantHi, i’m also interested in this, i when i included wpshowposts in my blog i had to disable defering javascripts in order to your plugin works right.
This is my current config
October 29, 2020 at 4:46 am #21878Carlo
ParticipantIs it possible to exclude certain scripts from being deferred?
Hi Tom,
I guess so, I found this:
https://docs.wp-rocket.me/article/976-exclude-files-from-defer-jsCould you tell me what are the script paths to exclude?
Thank you. Carlo
October 29, 2020 at 2:04 pm #21908Tom
KeymasterTry this:
/wp-content/plugins/wp-show-posts-pro/modules/carousel/slick/slick.min.js
October 29, 2020 at 2:19 pm #21924Carlo
ParticipantI tried this today (is still implemented) but no success. Could you please check?
The code in their php file is now (after my editing of $excluded_files[] row):
<?php /** * Plugin Name: WP Rocket | Exclude Files from Defer JS * Description: Exclude files from defer JS option. * Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/static/wp-rocket-static-exclude-defer-js/ * Author: WP Rocket Support Team * Author URI: http://wp-rocket.me/ * License: GNU General Public License v2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html * * Copyright SAS WP MEDIA 2018 */ namespace WP_Rocket\Helpers\static_files\exclude\defer_js; // Standard plugin security, keep this line in place. defined( 'ABSPATH' ) or die(); /** * Exclude scripts from WP Rocket’s defer JS option. * * @author Caspar Hübinger * @param array $excluded_files Array of script URLs to be excluded * @return array Extended array script URLs to be excluded */ function exclude_files( $excluded_files = array() ) { /** * EDIT THIS: * Edit below line as needed to exclude files. * To exclude mupltiple files, copy the entire line into a new line for each file you wish you exclude. */ $excluded_files[] = '/wp-content/plugins/wp-show-posts-pro/modules/carousel/slick/slick.min.js'; // STOP EDITING return $excluded_files; } add_filter( 'rocket_exclude_defer_js', __NAMESPACE__ . '\exclude_files' );
October 29, 2020 at 2:22 pm #21927Carlo
ParticipantI also excluded the same path from concatenation in wprockets options.
I am not sure if something has changed (not visible yet).When reloading the page, the carousel appears for less than a second and then disappear.
October 29, 2020 at 2:38 pm #21930Michal
ParticipantHi, for me it works fine! i could enable java script deferring again but with “safe mode for jQuery” enabled.
October 30, 2020 at 4:31 am #21958Carlo
ParticipantHi Michal,
would you like to share your steps?
Did you install the “extra” plugin? (https://docs.wp-rocket.me/article/976-exclude-files-from-defer-js)
If yes, what was the edited code?What are the options activated in wprocket settings?
Thank you 🙂
October 30, 2020 at 8:50 am #21978Carlo
ParticipantNever mind, it seems to work now.
I am still testing but I think it was wp rocket and then asset cleanup 😀Thank you guys.
October 30, 2020 at 11:29 am #21988Tom
KeymasterGlad it’s working now 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.