<?php
$the_post = get_previous_post();
$title = "";
$thumbnail = "";
$subtitle = esc_html__("Next article", "aventa");

if($the_post){
    $title = get_the_title($the_post);
    
    if ( has_post_thumbnail($the_post->ID) ){
        $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($the_post->ID), "full");
        $thumbnail = "<div class=\"bg\"><img src=\"". esc_url($thumbnail[0]) ."\" alt=\"". esc_attr($title)."\"></div>";
    }

?>
<div class="post-nav">
<?php
    echo previous_post_link("%link",  $thumbnail ."<span class=\"post-title\"><span>" . $subtitle . "</span>".$title."</span>");
?>
</div>
<?php } ?>
