Ethos carousel

Hello, A few months ago my ethos carousal slider stop sliding to the left.
A code fix was applied. but now the slider has stopped again. I am not sure if after an update the problem started.
Can someone look at it again to resolve the problem we are having.

Thank you,
TH.

Hi @TrevH,

Thank you for reaching out to us. I checked your site and your Carousel is sliding fine on my end, I checked both left and right sliding and both works fine. This could be just a cache issue as I see you’re using a cache plugin, please clear all caches including your browser’s cache and check the site again.

However if you need to auto slide your Carousel then copy _post-carousel.php located in \x\framework\legacy\cranium\headers\views\ethos and paste in the same folder in your child theme \x-child\framework\legacy\cranium\headers\views\ethos if you don’t find the folders inside the child theme then create new folders of the same names. Open the copied file and search for the line

jQuery('.x-post-carousel').xSlick({

Insert the code

autoplay : true,

under it so the whole script should look like:

<script>

      jQuery(document).ready(function() {
        jQuery('.x-post-carousel').xSlick({
		  autoplay       : true,
          speed          : 500,
          slide          : 'li',
          slidesToShow   : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_extra_large' ); ?>,
          slidesToScroll : 1,
          rtl            : <?php echo json_encode( is_rtl() ); ?>,
          responsive     : [
            { breakpoint : 1500, settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_large' ); ?> } },
            { breakpoint : 1200, settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_medium' ); ?> } },
            { breakpoint : 979,  settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_small' ); ?> } },
            { breakpoint : 550,  settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_extra_small' ); ?> } }
          ]
        });
      });

      </script>

Don’t forget to clear all caches including your browser’s cache after adding the code. Let us know how this goes!

Hello Nabeel,

On the sliders I am not talking the manual left and right arrows, it was coded to auto slide left on its own.and this is about the 2nd time this year it has stopped working. I am not sure if it was after the last update. You can check because it can be coded to auto slide.

Thank You
TH.

Hey @TrevH,

Does your custom coding added in the child theme? Any modifications must be placed in the child theme so that it will not be overwritten when there is an X theme updates. If you can provide us access to your site, then we maybe able to investigate further why this happens every time you update.

By the way, after doing the updates, always remember to clear all caches (if you are using Comet Cache, WP Rocket, WP SuperCache or W3 Total Cache) when updating so that the code from the latest release is always in use. This will help you to avoid any potential errors.

Regards.

Hello RueNel,

You can use the login user name and password below:

Thank You,
TH.

Hello TrevH,

I already temporarily deactivate your caching plugin and inserted this code:

<?php

// =============================================================================
// VIEWS/ETHOS/_POST-CAROUSEL.PHP
// -----------------------------------------------------------------------------
// Outputs the post carousel that appears at the top of the masthead.
// =============================================================================

GLOBAL $post_carousel_entry_id;

$post_carousel_entry_id = get_the_ID();

$is_enabled = x_get_option( 'x_ethos_post_carousel_enable' ) == '1';
$count      = x_get_option( 'x_ethos_post_carousel_count' );
$display    = x_get_option( 'x_ethos_post_carousel_display' );

switch ( $display ) {
  case 'most-commented' :
    $args = array(
      'post_type'      => 'post',
      'posts_per_page' => $count,
      'orderby'        => 'comment_count',
      'order'          => 'DESC'
    );
    break;
  case 'random' :
    $args = array(
      'post_type'      => 'post',
      'posts_per_page' => $count,
      'orderby'        => 'rand'
    );
    break;
  case 'featured' :
    $args = array(
      'post_type'      => 'post',
      'posts_per_page' => $count,
      'orderby'        => 'date',
      'meta_key'       => '_x_ethos_post_carousel_display',
      'meta_value'     => 'on'
    );
    break;
}

?>

<?php if ( $is_enabled ) : ?>

  <?php $wp_query = new WP_Query( $args ); ?>

  <?php if ( $wp_query->post_count > 0 ) : ?>

    <ul class="x-post-carousel unstyled">

      <?php if ( $wp_query->have_posts() ) : ?>
        <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>

          <li class="x-post-carousel-item">
            <?php x_ethos_entry_cover( 'post-carousel' ); ?>
          </li>

        <?php endwhile; ?>
      <?php endif; ?>

     <script>

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

      </script>

    </ul>

  <?php endif; ?>

  <?php wp_reset_query(); ?>

<?php endif; ?>

When I view your site, it still displays the same and my changes not displayed. It seems as if the file were not implemented in the front end. I have investigated this and I found out that there is an extra space in your folder name "ethos ".

Please login to your ftp, correct the folder name and remove the extra space.

Hello RueNel,

It did solve the problem, but The Hosting company and I, are just trying to figure out if it was after an update or what would cause a space or a glitch to happen. This is about the third time this has happen to the carousel.
with a different fix each time.No codes entered and no FTP was touched, I am not ruling out a glitch from the Hosting company either.

I am glad I am out of the IT field at this point,
Thanks for your help.
TH.

You’re welcome! We’re glad we were able to help you out.
If you need anything else we can help you with, don’t hesitate to open another thread.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.