We're merging with GenerateBlocks! Learn more here.

[Resolved] carousel not showing on mobiles when wprocket mobile cache is on

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support carousel not showing on mobiles when wprocket mobile cache is on

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #21736
    Carlo
    Participant

    Hi 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.

    #21739
    Carlo
    Participant

    Sorry, a word is missing, I meant:
    If I switch OFF mobile caching in wp rocket, the carousel works.

    #21800
    Carlo
    Participant

    update: it does not work on PCs either.

    Waiting forward for your support. Thank you. Carlo

    #21822
    Tom
    Keymaster

    Hi 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?

    #21858
    Michal
    Participant

    Hi, 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

    #21878
    Carlo
    Participant

    Is 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-js

    Could you tell me what are the script paths to exclude?

    Thank you. Carlo

    #21908
    Tom
    Keymaster

    Try this:

    /wp-content/plugins/wp-show-posts-pro/modules/carousel/slick/slick.min.js

    #21924
    Carlo
    Participant

    I 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' );
    
    #21927
    Carlo
    Participant

    I 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.

    #21930
    Michal
    Participant

    Hi, for me it works fine! i could enable java script deferring again but with “safe mode for jQuery” enabled.

    #21958
    Carlo
    Participant

    Hi 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 🙂

    #21978
    Carlo
    Participant

    Never mind, it seems to work now.
    I am still testing but I think it was wp rocket and then asset cleanup 😀

    Thank you guys.

    #21988
    Tom
    Keymaster

    Glad it’s working now 🙂

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.