Good morning.
I’d like to have in my carousel, which is on the top of my Blog page, the last posts that I have written.
I set on the Ethos option “featured” and I saw that the entire carousel was disappeard. I don’t what “random”, so I selected “most commented”, but it’s non sense.
So, can you help me to set “last posts” on my carousel?
Thank you so much.
Best regards.
Hi There,
Please keep the most commented option and copy this file from the parent theme to child theme in the same directory:
x/framework/legacy/cranium/headers/views/ethos/_post-carousel.php
After that update the code of that file to this:
<?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' => 'date',
'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({
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; ?>
Hope it helps 
Thank you so much.
I don’t understand why you wrote to me that I have to do something in my child theme. I’m already using the X child theme, not the parent theme, so for me everything is done inside the child theme, isn’t it? Can you, plese, wrote to me the path inside the Wordpress-X Theme mask where I can find the directory you told me? It isn’t in the CSS code, right? On the template code I can’t see nothing and I don’t use any local directory, because I’m using wordpress.com insted of wordpress.org.
What I’m not understanding? Isn’t it more simple add on the optiona in the Ethos “last posts”?
Thank you
Hi Patrizia,
It has to be done in the child theme, it’s the file x/framework/legacy/cranium/headers/views/ethos/_post-carousel.php which is your parent theme file. Now, you have to copy that file to your child theme that will result to x-child/framework/legacy/cranium/headers/views/ethos/_post-carousel.php and make sure its code is as provided by Thai.
You’ll not find that file from your child theme directory, it’s still located from your parent directory and has to be copied to the child theme.
And these are PHP related and not CSS.
But, given the Wordpress.com doesn’t allow FTP, then you’ll have to do it on your local folder (make sure you have a copy of both /x/ and /x-child/ in your computer and do the changes there). Once you’re done with the changes, you’ll have to zip your x-child folder resulting to x-child.zip, then login in your site’s Wordpress admin and deactivate your child theme and delete it. Then installl/upload your latest x-child.zip (contains the edited the file _post-carousel.php) in Admin > Appearance > Themes > Add New > Upload Theme
Please check this https://en.support.wordpress.com/ftp-access/
You may also contact Wordpress.com for other alternatives.
Hope this helps.
Ok, thanks. I’ll try to ask some help to worpress staff about it.
Best regards
You are most welcome!
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.