File: //home/madepabj/gamepointpk.com/wp-content/themes/groovy/partials/home-blocks/posts-slider.php
<?php
$epcl_module = epcl_get_module_options();
if( empty($epcl_module) ) return; // no data from slider module
$prefix = EPCL_THEMEPREFIX.'_';
$args = array(
'post_type' => 'post',
'showposts' => $epcl_module['posts_slider_limit'],
'suppress_filters' => false,
'meta_key' => '_thumbnail_id'
);
if( isset($epcl_module['featured_categories']) && $epcl_module['featured_categories'] != '' ){
$args['cat'] = $epcl_module['featured_categories'];
}
if( isset($epcl_module['excluded_categories']) && $epcl_module['excluded_categories'] != '' ){
$args['category__not_in'] = $epcl_module['excluded_categories'];
}
$slider = get_posts($args);
$thumbnail_size = 'epcl_fullcover';
?>
<?php if( !empty($slider) ): ?>
<div class="np-mobile np-tablet">
<!-- start: .epcl-slider -->
<section class="epcl-slider slick-slider top-arrows grid-container grid-parent" data-show="1" data-rtl="<?php echo is_rtl(); ?>" id="<?php echo wp_unique_id('epcl-post-slider-'); ?>">
<?php foreach($slider as $post): setup_postdata($post); ?>
<?php
$post_meta = get_post_meta( $post->ID, 'epcl_post', true );
$image_id = get_post_thumbnail_id($post->ID);
$image_alt = $image_url = '';
if($image_id){
$thumb = wp_get_attachment_image_src( $image_id, $thumbnail_size );
$image_alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true);
$image_url = $thumb[0];
}
$optimized_image = '';
if( defined('EPCL_PLUGIN_PATH') && !empty($post_meta) ){
if( isset( $post_meta['optimized_image_slider'] ) && $post_meta['optimized_image_slider']['url'] != '' ){
$optimized_image = $post_meta['optimized_image_slider'];
}
if( isset($optimized_image['alt']) && $optimized_image['alt'] != ''){
$image_alt = $optimized_image['alt'];
}
if( !empty($optimized_image) ){
$image_url = $optimized_image['url'];
}
}
if( !$image_alt ){
$image_alt = get_the_title();
}
$reading_time = epcl_reading_time( get_the_content() );
?>
<div class="item <?php if($image_url) echo 'image-bg'; ?>">
<article>
<img class="img bg-box" alt="<?php echo esc_attr($image_alt); ?>" src="<?php echo EPCL_THEMEPATH; ?>/assets/images/transparent.gif" data-lazy="<?php echo esc_url($image_url); ?>">
<div class="meta absolute">
<?php if( isset($epcl_module['enable_categories']) && $epcl_module['enable_categories'] ): ?>
<?php echo epcl_render_categories(2); ?>
<?php endif; ?>
<div class="inline-block hide-on-mobile hide-on-tablet">
<?php if( epcl_get_option('enable_global_date') !== '0' ): ?>
<time class="" datetime="<?php the_time('Y-m-d'); ?>"><?php the_time( get_option('date_format') ); ?></time>
<?php endif; ?>
<?php if( epcl_get_option( 'enable_global_reading_time', true ) ): ?>
<div class="min-read"><span class="count"><?php echo esc_attr( $reading_time ); ?></span> <?php esc_html_e('Min Read', 'groovy'); ?></div>
<?php endif; ?>
<?php if( $epcl_module['enable_author'] ): ?>
<?php get_template_part('partials/meta-info/author'); ?>
<?php endif;?>
</div>
</div>
<!-- start: .info -->
<div class="info">
<h2 class="post-title title shadow-effect no-margin textcenter">
<a href="<?php the_permalink(); ?>" class=""><?php the_title(); ?></a>
</h2>
</div>
<!-- end: .info -->
<a href="<?php the_permalink(); ?>" class="continue-reading epcl-button white active hide-on-mobile hide-on-tablet"><?php echo esc_html__('Continue Reading', 'groovy'); ?> <svg><use xlink:href="#right-arrow"></use></svg></a>
</article>
</div>
<?php endforeach; wp_reset_postdata(); ?>
</section>
<!-- end: .epcl-slider -->
</div>
<?php endif; ?>