<?php 
/**
 * Template part for displaying About Section
 *
 *@package Party Planner Bell
 */

    $features_title       = party_planner_bell_get_option( 'features_title' );
    $features_subtitle       = party_planner_bell_get_option( 'features_subtitle' );
    $background_features_section     = party_planner_bell_get_option( 'background_features_section' );
    $features_content_type     = party_planner_bell_get_option( 'features_content_type' );
    $number_of_features_items  = party_planner_bell_get_option( 'number_of_features_items' );
    $features_category = party_planner_bell_get_option( 'features_category' );
    $disable_features_icon = party_planner_bell_get_option( 'disable_features_icon' );
    $features_header_font_size = party_planner_bell_get_option( 'features_font_size');
    $features_content_font_size = party_planner_bell_get_option( 'features_content_font_size');
    $features_subtitle_font_size = party_planner_bell_get_option( 'features_subtitle_font_size');
    $features_section_header_font_size = party_planner_bell_get_option( 'features_section_header_font_size');
    $features_button_label = party_planner_bell_get_option( 'features_button_label');
    $home_layout = party_planner_bell_get_option( 'homepage_design_layout_options');
    $excerpt_length =party_planner_bell_get_option( 'features_excerpt_length');
    $video_link_url =party_planner_bell_get_option( 'features_video_link_url');
    for( $i=1; $i<=$number_of_features_items; $i++ ) :
        $features_page_posts[] = absint(party_planner_bell_get_option( 'features_page_'.$i ) );
        $features_post_posts[] = absint(party_planner_bell_get_option( 'features_post_'.$i ) );
    endfor;
    ?>
    <style>
        <?php if ($features_subtitle_font_size != 0): ?>
            #features .section-subtitle{
                font-size:<?php echo esc_html($features_subtitle_font_size); ?>px;
            }
        <?php endif ?>
        <?php if ($features_section_header_font_size != 0): ?>
            #features .section-title{
                font-size:<?php echo esc_html($features_section_header_font_size); ?>px;
            }
        <?php endif ?>

        <?php if ($features_header_font_size != 0): ?>
            #features .entry-title{
                font-size:<?php echo esc_html($features_header_font_size); ?>px;
            }
        <?php endif ?>
        <?php if ($features_content_font_size != 0): ?>
            #features .entry-content p{
                font-size:<?php echo esc_html($features_content_font_size); ?>px;
            }
        <?php endif ?>
    </style>
    <div class="featured-wrapper col-3">
        <?php 
            $args = array (

                'posts_per_page' =>absint( $number_of_features_items ),              
                'post_type' => 'post',
                'post_status' => 'publish',
                'paged' => 1,
                'ignore_sticky_posts' => true, 
                );
                if ( absint( $features_category ) > 0 ) {
                    $args['cat'] = absint( $features_category );
                }
        $loop = new WP_Query($args);                        
        if ( $loop->have_posts() ) :
            $i=0;  
            while ($loop->have_posts()) : $loop->the_post(); $i++;?>    
                <article class="features-item <?php echo has_post_thumbnail() ? 'has-post-thumbnail' : 'no-post-thumbnail' ; ?>" style="background-image:url('<?php the_post_thumbnail_url( 'full');?>');" >
                    <div class="overlay-one"></div>
                    <div class="overlay-two"></div>
                    
                    <div class="features-content" >
                        <header class="entry-header">
                            <h2 class="entry-title"><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
                        </header>

                        <div class="entry-content">
                            <?php
                                $excerpt = party_planner_bell_the_excerpt( $excerpt_length );
                                echo wp_kses_post( wpautop( $excerpt ) );
                            ?>                               
                        </div><!-- .entry-content -->
                        <?php if ( ! empty( $features_button_label )) : ?>
                            <div class="read-more">
                                <a href="<?php the_permalink();?>" class="btn btn-primary"><?php echo esc_html($features_button_label); ?></a>
                            </div>  
                        <?php endif; ?>
                    </div>  
                </article>
            <?php endwhile;?>
        <?php endif; ?>
        <?php wp_reset_postdata(); ?>
    </div>