<?php
/* ------------------------------------------------------------------------------
* Author: web-zone.org
* @package Airin Blog
* Description: Section Next post
* ------------------------------------------------------------------------------ */


?>
<nav class="airinblog-css-np-box">

    <div class="airinblog-css-np-post">
        <?php
        $previous_post = get_previous_post();
        if (!empty($previous_post)) {
            $prev_id = $previous_post->ID;
            $prev_img = get_the_post_thumbnail($prev_id, 'airinblog-img-155x87');
            $prev_url = get_permalink($prev_id);
            ?>
            <div class="airinblog-css-previous-post-link">
                <a href="<?php echo esc_url($prev_url); ?>"> &#10094; <?php esc_html_e('Previous post', 'airin-blog'); ?></a>
            </div>
            <div class="airinblog-css-previous-post-box">
                <?php
                if (!empty($prev_img)) {
                    echo '<div class="airinblog-css-np-post-img">'.$prev_img.'</div>';
                }
                ?>
                <div class="airinblog-css-np-post-title">
                    <a href="<?php echo esc_url($prev_url); ?>"><?php echo esc_html($previous_post->post_title); ?></a>
                </div>
            </div>
            <?php 
        } ?>
    </div>

    <div class="airinblog-css-np-post">
        <?php
        $next_post = get_next_post();
        if (!empty($next_post)) {
            $next_id = $next_post->ID;
            $next_img = get_the_post_thumbnail($next_id, 'airinblog-img-155x87');
            $next_url = get_permalink($next_id);
            ?>
            <div class="airinblog-css-next-post-link">
                <a href="<?php echo esc_url($next_url); ?>"><?php esc_html_e('Next post', 'airin-blog'); ?> &#10095; </a>
            </div>
            <div class="airinblog-css-next-post-box">
                <?php
                if (!empty($next_img)) {
                    echo '<div class="airinblog-css-np-post-img">'.$next_img.'</div>';
                }
                ?>
                <div class="airinblog-css-np-post-title">
                    <a href="<?php echo esc_url($next_url); ?>"><?php echo esc_html($next_post->post_title); ?></a>
                </div>
            </div>
            <?php 
        } ?>
    </div>
    
</nav>
