Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #209451

    KAEC IT Team
    Participant

    Hi,

    A few weeks back, I found how to edit .php files to get the Ethos carousel to autoplay, but I can no longer locate said forum thread. I’m not sure if it was removed because the code is no longer effective, or if I’m simply having issues with forum search. I only come up with two KB articles on “Post IDs” and “demo content” when searching for “carousel”, “autoplay”, and “ethos”. Any idea how we would set our post carousel to autoplay?

    #209726

    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    And I’m not sure what to look from search either. So I’ll just repeat it here and be sure you will bookmarked this too. ๐Ÿ™‚

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    1. Copy _post-carousel.php from /x/framework/views/ethos/ to /x-child-ethos/framework/views/ethos/

    2. Edit your child theme’s _post-carousel.php and add these options :

    autoplay: true,
    autoplaySpeed: 2000,

    right before this :

    speed : 500,

    So it should be like this :

    <script>
    
        jQuery(document).ready(function() {
          jQuery('.x-post-carousel').slick({
            autoplay: true,
            autoplaySpeed: 2000,
            speed          : 500,
            slide          : 'li',
            slidesToShow   : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_extra_large', '5' ); ?>,
            slidesToScroll : 1,
            responsive     : [
              { breakpoint : 1500, settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_large', '4' ); ?> } },
              { breakpoint : 1200, settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_medium', '3' ); ?> } },
              { breakpoint : 979,  settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_small', '2' ); ?> } },
              { breakpoint : 550,  settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_extra_small', '1' ); ?> } }
            ]
          });
        });
    
        </script>

    Hope this helps ๐Ÿ™‚

    #210069

    KAEC IT Team
    Participant

    This worked exactly once, and stopped as soon as I shrank my browser window. Any known issues?? I’m not getting any hard conflicts. Cleared my cache, even tried turning off page compression…

    #210089

    KAEC IT Team
    Participant

    OK, so at full-screen it begins to move again. At smaller sizes it does not. Could this be related to the carousel slides-per-screen setting? My settings in customizer:

    Over 1500 pixels: 4
    1200-1499 Pixels: 4
    979-1199 Pixels: 3
    550-978 Pixels: 2
    Below 549 Pixels: 1

    Thanks

    #210410

    Rad
    Moderator

    Hi there,

    I think it’s normal to the carousel library, where autoplay won’t be available on mobile size. And nothing we can’t do about it but request it as feature enhancement of existing library.

    I checked the coding just to confirm it.

    Thanks!

    #211247

    KAEC IT Team
    Participant

    Ah well, maybe one day in a future update. It’s not only “mobile”, but also when moving my browser window from literally the entire screen (27″ iMac) to 3/4 or less of the widescreen monitor. It does not work on mobile either though. Thanks for looking into it.

    #211830

    John Ezra
    Member

    Youโ€™re welcome.