Tagged: x
-
AuthorPosts
-
March 10, 2017 at 9:23 am #1401975
victorlisboaParticipanthi, first of all, congrats for this awesome theme. But there’s a way to carousel dynamically exclude the actual post? since the user is viewing a post, there’s no reason for carousel include it. thank you in advance.
March 10, 2017 at 10:26 am #1402049
DarshanaModeratorHi there,
Thanks for writing in! To assist you with this request, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
March 10, 2017 at 11:26 am #1402110
victorlisboaParticipantSure, for example I would like to exclude from carousel the entry for this post when the user is reading it: http://ano-zero.com/o-nosso-real-despertar/
March 10, 2017 at 10:01 pm #1402694
Rue NelModeratorHello There,
Thanks for updating in! To resolve this issue, since you have your child theme active and ready, please follow the following steps below:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file<?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', 'post__not_in' => array($post_carousel_entry_id) ); break; case 'random' : $args = array( 'post_type' => 'post', 'posts_per_page' => $count, 'orderby' => 'rand', 'post__not_in' => array($post_carousel_entry_id) ); break; case 'featured' : $args = array( 'post_type' => 'post', 'posts_per_page' => $count, 'orderby' => 'date', 'meta_key' => '_x_ethos_post_carousel_display', 'meta_value' => 'on', 'post__not_in' => array($post_carousel_entry_id) ); break; } ?> <?php if ( $is_enabled ) : ?> <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, 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; ?>3] Save the file named as
_post-carousel.php
4] Upload this file to your server in the child theme’s folder
wp-content/themes/x-child/framework/views/ethos/We would loved to know if this has work for you. Thank you.
March 11, 2017 at 10:02 am #1403131
victorlisboaParticipantWell, it didn’t work. But since I’ve already have a _post-carousel.php in my child theme (due to exclude carousel in home) and to show recent posts, I realized that I can just insert “$exclude_ids = array(get_the_ID());” to exclude the actual post.
So, for other clients too, heres de code we need to insert in _post-carousel.php (child theme) to hide carousel in home (appearing in posts and pages), showing recent posts AND excluding the actual post:
=======================
<?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’ );$exclude_ids = array(get_the_ID()); // Enter the IDs of posts you want to exclude
$args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => $count, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘post__not_in’ => $exclude_ids );?>
<?php if ( $is_enabled && (is_home() || is_front_page() ) ) { ?>
<div class=”x-img-banner”>
</div><?php } else { ?>
<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’ ); ?><?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’, ‘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>
<?php } ?>
=======================
Thank you very much for your assistance!
March 11, 2017 at 11:29 am #1403203
ThaiModeratorHi There,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link login to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thanks.
March 11, 2017 at 4:15 pm #1403327
victorlisboaParticipantThis reply has been marked as private.March 12, 2017 at 12:28 am #1403563
Rue NelModeratorHello There,
Thanks for providing the information. Regretfully the given ftp details is not working for us. Please double check it so that we can log in and check your _psot-carousel.php file
By the way, I checked the page (http://ano-zero.com/espirito-santo/) again and I no longer see any duplicates of the post in the carousel.
Hope to hear from you soon.
March 12, 2017 at 1:19 pm #1403920
victorlisboaParticipantThis reply has been marked as private.March 12, 2017 at 9:08 pm #1404271
Rue NelModeratorHello There,
You’re most welcome. Glad to know that it has been useful to you.
If you need anything else we can help you with, don’t hesitate to open another thread.Cheers.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1401975 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
