Ethos Carousel with Custom Post Type: Display Featured not working

Hello. I’ve worked with a developer to get the Ethos Carousel (X Theme) displaying a custom post type called a “story.”

It works fine when the carousel is set to display “random” in the theme options, but displaying “featured” does not work even though we’ve created a custom field for “x_ethos_post_carousel_display” with a value of “on” on some test story posts.

Can anybody spare a moment to look at this and see if you can figure out what’s wrong?

<?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'      => 'story',
			'posts_per_page' => $count,
			'orderby'        => 'comment_count',
			'order'          => 'DESC'
		);
		break;
	case 'random' :
		$args = array(
			'post_type'      => 'story',
			'posts_per_page' => $count,
			'orderby'        => 'rand'
		);
		break;
	case 'featured' :
		$args = array(
			'post_type'      => 'story',
			'posts_per_page' => $count,
			'orderby'        => 'date',
//            'post__in' => array(4901, 4900, 4899, 4898, 4897, 4896)
			'meta_key'       => '_x_ethos_post_carousel_display',
			'meta_value'     => 'on'
		);
		break;
}

?>

<?php if ( $is_enabled && (is_home() || is_front_page())) : ?>

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

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

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

		<?php wp_reset_query(); ?>

        <script>

            jQuery(document).ready(function() {
                jQuery('.x-post-carousel').slick({
                    speed          : 500,
                    slide          : 'li',
                    slidesToShow   : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_extra_large' ); ?>,
                    slidesToScroll : 1,
                    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; ?>

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