<?php
/**
 * Template For Footer News
 * @since 1.0
 * @package RoyalNews
 */

$news_post = get_query_var( 'royalnews_footer-news', false );
if( !empty($news_post) ){ ?>
    <div class="container royalnews-footer-news-wrapper">
        <?php if( '' != royalnews_value( 'footer-news-title-text' ) ){ ?>
            <h3 class="footer-news-title"> 
                <?php echo esc_html( royalnews_value( 'footer-news-title-text' ) ); ?>                
            </h3>
        <?php } ?>        
        <div class="royalnews-footer-news-initilize">
            <?php foreach( $news_post as $np ){
                if( has_post_thumbnail( $np ) ){
                    $url = get_the_post_thumbnail_url( $np );
                }else{
                    $url = get_template_directory_uri() . '/assets/images/placeholder.jpg';
                }?>
                <div class="royalnews-footer-news-inner">
                    <div class="royanews-main-single-slider-img">
                        <a href="<?php echo esc_url( get_the_permalink( $np ) ); ?>" class="royalnews-slider-link">
                            <img src="<?php echo $url; ?>" alt="<?php the_title(); ?>">
                        </a>
                    </div>
                    <div class="royalnews-slider-data">
                        <?php royalnews_the_category( $np ); ?>
                        <h2>
                            <a href="<?php echo esc_url( get_the_permalink( $np ) ); ?>">                                
                                <?php echo esc_html( get_the_title( $np ) ); ?>
                            </a>
                        </h2>
                        <div class="royalnews-slider-meta">
                            <?php royalnews_posted_by( get_the_id() );
                            royalnews_the_date(); ?>
                        </div>
                    </div>
                </div>
            <?php } ?>
        </div>
    </div>
<?php } ?>