<?php
    $flash_content_type     = magazine_bell_get_option( 'flash_content_type' );
    $flash_title       = magazine_bell_get_option( 'flash_title' );
    $number_of_flash_items  = magazine_bell_get_option( 'number_of_flash_items' );
    $flash_category = magazine_bell_get_option( 'flash_category' );
    $header_font_size = magazine_bell_get_option( 'flash_font_size');    

    for( $i=1; $i<=$number_of_flash_items; $i++ ) :
        $flash_page_posts[] = absint(magazine_bell_get_option( 'flash_page_'.$i ) );
        $flash_post_posts[] = absint(magazine_bell_get_option( 'flash_post_'.$i ) );
    endfor;

?>

<?php if( !empty($flash_title)):?>
    <div class="news-header">
        <h2 class="news-title"><?php echo esc_html($flash_title);?></h2>
    </div>       
<?php endif;?>  
<div class="flash-posts">
    <div class="headline-animation">
        <ul>      
            <?php $args = array (
                    'post_type'     => 'post',
                    'post_per_page' => count( $flash_post_posts ),
                    'post__in'      => $flash_post_posts,
                    'orderby'       =>'post__in', 
                    'ignore_sticky_posts' => true, 
                ); 
            $loop = new WP_Query($args);                        
            if ( $loop->have_posts() ) :
                $i=0; 
                while ($loop->have_posts()) : $loop->the_post(); $i++;?> 
                    <div class="flash-items">
                        <?php if (has_post_thumbnail()) : ?>
                            <div class="featured-image" style="background-image: url('<?php the_post_thumbnail_url('post-thumnbail');?>');">
                                <a href="<?php the_permalink();?>" class="post-thumbnail-link"></a>
                            </div><!-- .featured-image -->
                        <?php endif; ?>
                        <li class="entry-title" style="font-size: <?php echo esc_attr($header_font_size); ?>px; " ><a href="<?php the_permalink();?>"><?php the_title();?></a></li> 
                    </div>        
                <?php endwhile;?>
            <?php endif; ?>
            <?php wp_reset_postdata(); ?>
        </ul>
    </div>
</div><!-- .section-content -->