HEX
Server: LiteSpeed
System: Linux premium221.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: madepabj (2566)
PHP: 8.3.26
Disabled: NONE
Upload Files
File: //home/madepabj/gamepointpk.com/wp-content/themes/groovy/partials/home-blocks/posts-carousel.php
<?php
$epcl_module = epcl_get_module_options();
if( empty($epcl_module) ) return; // no data from carousel module
$prefix = EPCL_THEMEPREFIX.'_';
$args = array(
	'post_type' => 'post',
	'showposts' => $epcl_module['posts_carousel_limit'],
	'suppress_filters' => false,
    'meta_key' => '_thumbnail_id'
);

if( !empty($epcl_module) ){
    // Categories filters
    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'];
    }
    // Order by: Date, Views, Name
    if( isset($epcl_module['orderby']) && $epcl_module['orderby'] != '' ){
        $args['orderby'] = $epcl_module['orderby'];
        if( $epcl_module['orderby'] == 'views' ){
            $args['orderby'] = 'meta_value_num';
            $args['meta_key'] = 'views_counter';
        }
    }
    // Posts order: ASC, DESC
    if( isset($epcl_module['posts_order']) && $epcl_module['posts_order'] != '' ){
        $args['order'] = $epcl_module['posts_order'];
    }
    // Filter by date (year, month, etc)
    if( isset($epcl_module['date']) && $epcl_module['date'] != 'alltime' ){
        $year = date('Y');
        $month = absint( date('m') );
        $week = absint( date('W') );
    
        $args['year'] = $year;
    
        if( $epcl_module['date'] == 'pastmonth' ){
            $args['monthnum'] = $month - 1;
        }
        if( $epcl_module['date'] == 'pastweek' ){
            $args['w'] = $week - 1;
        }
        if( $epcl_module['date'] == 'pastyear' ){
            unset( $args['year'] );
            $today = getdate();
            $args['date_query'] = array(
                array(
                    'after' => $today[ 'month' ] . ' 1st, ' . ($today[ 'year' ] - 2)
                )
            );
        }
    }
}

$carousel = get_posts($args);
$thumbnail_size = 'medium_large';
if($epcl_module['posts_carousel_show_limit'] == 1){
	$thumbnail_size = 'large';
}
?>

<?php if( !empty($carousel) ): ?>
    <div class="grid-container grid-ularge np-mobile np-tablet">
        <!-- start: .carousel -->
        <section class="epcl-carousel slick-slider outer-arrows slides-<?php echo intval( $epcl_module['posts_carousel_show_limit'] ); ?>" data-show="<?php echo intval( $epcl_module['posts_carousel_show_limit'] ); ?>" data-rtl="<?php echo is_rtl(); ?>" id="<?php echo wp_unique_id('epcl-post-carousel-'); ?>">
            <?php foreach($carousel as $post): setup_postdata($post); ?>
                <?php
                    $image_id = get_post_thumbnail_id($post->ID);
                    $post_meta = get_post_meta( $post->ID, 'epcl_post', true );
                    $thumb = wp_get_attachment_image_src( $image_id, $thumbnail_size );
                    $image_alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true);
                    $image_url = '';
                    if( !empty($thumb) ){
                        $image_url = $thumb[0];
                    }
                    if( defined('EPCL_PLUGIN_PATH') && !empty($post_meta) ){
                        if( isset( $post_meta['optimized_image'] ) && $post_meta['optimized_image']['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();
                    }

                ?>
                <div class="item <?php if($image_url) echo 'image-bg'; ?>">
                    <article class="main-effect bg-box">
                        
                        <?php if( $image_url ): ?>
                            <div class="epcl-loader">
                                <?php if( epcl_get_option('enable_lazyload') == '1' ): ?>
                                    <div class="img cover lazy" src="<?php echo EPCL_THEMEPATH; ?>/assets/images/transparent.gif" data-src="<?php echo esc_url($image_url); ?>"></div>
                                <?php else: ?>
                                    <div class="img cover" style="background-image: url('<?php echo esc_url($image_url); ?>');"></div>
                                <?php endif; ?>
                            </div>
                        <?php endif; ?>

                        <?php if( isset($epcl_module['posts_carousel_enable_category']) && $epcl_module['posts_carousel_enable_category'] ): ?>
                            <div class="tags absolute">
                                <?php echo epcl_get_primary_category_link($post_meta, $post->ID); ?>
                            </div>
                        <?php endif; ?> 
                        
                        <!-- 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 --> 

                        <div class="clear"></div>

                        <a href="<?php the_permalink(); ?>" class="full-link" aria-label="<?php the_title(); ?>"><span class="hidden"><?php the_title(); ?></span></a>
                    </article>
                </div>
            <?php endforeach; wp_reset_postdata(); ?>
        </section>
        <!-- end: .carousel -->
    </div>
<?php endif; ?>