<?php 
/**
 * Template part for displaying Featured Courses Section
 *
 *@package prime-construction  
 */
    $featured_whatweoffer_title               = prime_construction_get_option( 'featured_whatweoffer_title' );
    $featured_whatweoffer_subtitle            = prime_construction_get_option( 'featured_whatweoffer_subtitle' );
    $featured_whatweoffer_subtitle1           = prime_construction_get_option( 'featured_whatweoffer_subtitle1' );

    $featured_whatweoffer_column              = prime_construction_get_option( 'featured_whatweoffer_column' );
    $featured_whatweoffer_content_type        = prime_construction_get_option( 'featured_whatweoffer_content_type' );
    $number_of_featured_whatweoffer_items     = prime_construction_get_option( 'number_of_featured_whatweoffer_items' );
    $featured_whatweoffer_card_title          = prime_construction_get_option( 'featured_whatweoffer_card_title' );
    $featured_whatweoffer_card_paragraph      = prime_construction_get_option( 'featured_whatweoffer_card_paragraph' );
    $featured_whatweoffer_button              = prime_construction_get_option( 'featured_whatweoffer_button' );  
    $featured_icon_card_icon                  = prime_construction_get_option( 'featured_icon_card_icon' );  
    $whatweoffer_heading_icon                 = get_theme_mod( 'whatweoffer_heading_icon' );
    // $whatweoffer_enable_section               = get_theme_mod('whatweoffer_enable_section', 'on');
   
    ?>
<?php if (!get_theme_mod('whatweoffer_enable_section', true)) {
    return;
} ?>
<div class="featured-whatweoffer" Id="primaryid">
    <!-- title start -->
    <h6 class="head-title"
        style="text-transform : <?php if(get_theme_mod('featured_whatweoffer_title_case','Uppercase') == 'Uppercase'){ ?> Uppercase <?php } elseif(get_theme_mod('featured_whatweoffer_title_case','Capitalize') == 'Capitalize'){ ?> Capitalize <?php } elseif(get_theme_mod('featured_whatweoffer_title_case','Lowercase') == 'Lowercase'){ ?> Lowercase <?php } elseif(get_theme_mod('featured_whatweoffer_title_case','None') == 'None'){ ?> none <?php } ?>">
        <?php echo esc_html($featured_whatweoffer_title);?></h6>
    <!-- title end -->

    <!-- sub-title start -->
    <h1 class="head-subtitle justify-content-center z-5 mt-3"
        style="text-transform : <?php if(get_theme_mod('featured_whatweoffer_subtitle_case','Capitalize') == 'Capitalize'){ ?> Capitalize <?php }  elseif(get_theme_mod('featured_whatweoffer_subtitle_case','Uppercase') == 'Uppercase'){ ?> Uppercase <?php } elseif(get_theme_mod('featured_whatweoffer_subtitle_case','Lowercase') == 'Lowercase'){ ?> Lowercase <?php } elseif(get_theme_mod('featured_whatweoffer_subtitle_case','None') == 'None'){ ?> none <?php } ?> ">
        <?php echo esc_html($featured_whatweoffer_subtitle);?></h1>
    <h1 class="head-subtitle subtitle justify-content-center z-5 mb-5"
        style="text-transform : <?php if(get_theme_mod('featured_whatweoffer_subtitle_case','Capitalize') == 'Capitalize'){ ?> Capitalize <?php }  elseif(get_theme_mod('featured_whatweoffer_subtitle_case','Uppercase') == 'Uppercase'){ ?> Uppercase <?php } elseif(get_theme_mod('featured_whatweoffer_subtitle_case','Lowercase') == 'Lowercase'){ ?> Lowercase <?php } elseif(get_theme_mod('featured_whatweoffer_subtitle_case','None') == 'None'){ ?> none <?php } ?> ">
        <?php echo esc_html($featured_whatweoffer_subtitle1);?></h1>
    <!-- sub-title end -->
    <div class="container">
        <div
            class="grid xl:grid-cols-<?php echo esc_attr($featured_whatweoffer_column); ?> lg:grid-cols-<?php echo esc_attr($featured_whatweoffer_column); ?> md:grid-cols-3 sm:grid-cols-1 grid-cols-1 gap-4 mb-4">

            <?php      
            $number_of_featured_offer_items = absint( get_theme_mod('number_of_featured_offer_items', 6) );

            if ($number_of_featured_offer_items < 1) {
                $number_of_featured_offer_items = 1;
            }
            ?>
            
            <?php $prime_construction_slider_pages = array(); 
                for ( $count = 1; $count <= 6; $count++ ) {
                    $mod = intval( get_theme_mod( 'select_post_what_we_offer'. $count ));
                    if ( 'page-none-selected' != $mod ) {
                      $prime_construction_slider_pages[] = $mod;
                    }
                }
                if( !empty($prime_construction_slider_pages) ) :
                    $args = array(
                        'post_type' => 'post',
                        'post__in' => $prime_construction_slider_pages,
                        'posts_per_page' => $number_of_featured_offer_items,
                        'orderby' => 'post__in'
                    );
                    $prime_construction_catquery = new WP_Query( $args );
                    $prime_construction_catquery_counter = 0;
                    while ($prime_construction_catquery->have_posts() && $prime_construction_catquery_counter < $number_of_featured_offer_items) :
                        $prime_construction_catquery->the_post();
                        $prime_construction_catquery_counter++;
                        if ( has_post_thumbnail() ) : ?>
            <article class="animated <?php echo esc_attr(get_theme_mod('prime_construction_featured_whatweoffer_onload_effects','wow zoomIn')); ?>"
                data-wow-duration="2s">
                <div class="featured-service-item h-full z-5 mt-0">
                    <div class="entry-container service-card">
                        <a href="<?php the_permalink();?>" class="service-card-link">
                            <img class="image-container" src="<?php echo esc_url(get_the_post_thumbnail_url()); ?>"
                                alt="<?php echo esc_attr(get_the_title()); ?>"
                                style="height: <?php echo esc_attr(get_theme_mod('featured_whatweoffer_post_image_height','440')) ?>px;">
                            <div class="service-card-overlay">
                                <h2 class="title"><?php the_title(); ?></h2>
                            </div>
                        </a>
                    </div>
                </div>
            </article>
            <?php endif; ?>
            <?php endwhile; ?>
            <?php endif; ?>
            <?php wp_reset_postdata(); ?>

        </div>

        <?php if ( $featured_whatweoffer_button ) : ?>
            <div class="featured-services-cta text-center">
                <a href="#" class="featured-services-button"><?php echo esc_html( $featured_whatweoffer_button ); ?></a>
            </div>
        <?php endif; ?>

