function road_latestposts_shortcode($atts)
{
    global $road_opt;
    $k = 0;
    $atts = shortcode_atts(array('posts_per_page' => 5, 'order' => 'DESC', 'orderby' => 'post_date', 'image' => 'wide', 'length' => 20), $atts, 'latestposts');
    if ($atts['image'] == 'wide') {
        $imagesize = 'mirano-post-thumbwide';
    } else {
        $imagesize = 'mirano-post-thumb';
    }
    $html = '';
    $postinfocode = '';
    $postthumbcode = '';
    $postargs = array('posts_per_page' => $atts['posts_per_page'], 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => $atts['orderby'], 'order' => $atts['order'], 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'post_status' => 'publish', 'suppress_filters' => true);
    $postslist = get_posts($postargs);
    $html .= '<div class="posts-carousel">';
    foreach ($postslist as $post) {
        $k = 1 - $k;
        $html .= '<div class="item-col">';
        $html .= '<div class="post-wrapper">';
        $html .= '<div class="post-wrapper-inner">';
        $postthumbcode .= '<div class="post-thumb">';
        $postthumbcode .= '<div class="post-img">';
        $postthumbcode .= '<a href="' . get_the_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID, $imagesize);
        $postthumbcode .= '<span class="post-date3"><span class="day">' . get_the_date('d', $post->ID) . '</span><span class="month">' . get_the_date('M', $post->ID) . '</span></span>';
        $postthumbcode .= '<span class="shadow"></span>';
        $postthumbcode .= '</a>';
        $postthumbcode .= '<div class="post-meta ontop">';
        $num_comments = get_comments_number($post->ID);
        if (comments_open()) {
            if ($num_comments == 0) {
                $comments = __('<span>0</span> comments', 'roadthemes');
            } elseif ($num_comments > 1) {
                $comments = '<span>' . $num_comments . '</span>' . __(' comments', 'roadthemes');
            } else {
                $comments = __('<span>1</span> comment', 'roadthemes');
            }
            $write_comments = '<a href="' . get_comments_link($post->ID) . '">' . $comments . '</a>';
        }
        $postthumbcode .= '<span class="entry-date"><span class="day">' . get_the_date('d', $post->ID) . '</span><span class="month">' . get_the_date('M', $post->ID) . '</span><span class="year">' . get_the_date(',Y', $post->ID) . '</span></span>';
        $categories_list = get_the_category_list(',', '', $post->ID);
        $author = sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'roadthemes'), get_the_author())), get_the_author());
        $postthumbcode .= '</div>';
        $postthumbcode .= '</div>';
        $postthumbcode .= '</div>';
        $postinfocode .= '<div class="post-info">';
        $postinfocode .= '<h3 class="post-title"><a href="' . get_the_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></h3>';
        $postinfocode .= '<span class="post-date"><span class="day">' . get_the_date('d.', $post->ID) . '</span><span class="month">' . get_the_date('m.', $post->ID) . '</span><span class="year">' . get_the_date('Y', $post->ID) . '</span></span>';
        $postinfocode .= '<span class="entry-comment">' . $write_comments . '</span>';
        $postinfocode .= '<div class="post-excerpt">';
        $postinfocode .= road_excerpt_by_id($post, $length = $atts['length']);
        $postinfocode .= '</div>';
        $postinfocode .= '<a class="readmore" href="' . get_the_permalink($post->ID) . '">' . '<span>' . esc_html($road_opt['readmore_text']) . '</span>' . '</a>';
        $postinfocode .= '<ul class="list-infor">';
        $postinfocode .= '<li class="first"><span class="author">' . $author . '</span></li>';
        $postinfocode .= '<li><span class="category">' . $categories_list . '</span></li>';
        $postinfocode .= '<li class="last"><span class="entry-comment">' . $write_comments . '</span></li>';
        $postinfocode .= '</ul>';
        $postinfocode .= '</div>';
        if ($k == 0) {
            $html .= $postthumbcode;
            $html .= $postinfocode;
        } else {
            $html .= $postinfocode;
            $html .= $postthumbcode;
        }
        $postinfocode = '';
        $postthumbcode = '';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
    }
    $html .= '</div>';
    wp_reset_postdata();
    return $html;
}
function road_latestposts_shortcode($atts)
{
    global $road_opt;
    $atts = shortcode_atts(array('posts_per_page' => 5, 'order' => 'DESC', 'orderby' => 'post_date', 'image' => 'wide', 'length' => 20), $atts, 'latestposts');
    if ($atts['image'] == 'wide') {
        $imagesize = 'post-thumbwide';
    } else {
        $imagesize = 'post-thumb';
    }
    $html = '';
    $postargs = array('posts_per_page' => $atts['posts_per_page'], 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => $atts['orderby'], 'order' => $atts['order'], 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'post_status' => 'publish', 'suppress_filters' => true);
    $postslist = get_posts($postargs);
    $html .= '<div class="posts-carousel">';
    foreach ($postslist as $post) {
        $html .= '<div class="item-col">';
        $html .= '<div class="post-wrapper">';
        $html .= '<div class="post-thumb">';
        $html .= '<div class="images-container">';
        $html .= '<div class="post-meta ontop">';
        $num_comments = get_comments_number($post->ID);
        if (comments_open()) {
            if ($num_comments == 0) {
                $comments = __('<span>0</span> comments', 'roadthemes');
            } elseif ($num_comments > 1) {
                $comments = '<span>' . $num_comments . '</span>' . __(' comments', 'roadthemes');
            } else {
                $comments = __('<span>1</span> comment', 'roadthemes');
            }
            $write_comments = '<a href="' . get_comments_link($post->ID) . '">' . $comments . '</a>';
        }
        $html .= '<span class="entry-date"><span class="day">' . get_the_date('d', $post->ID) . '</span><span class="month">' . get_the_date('F', $post->ID) . '</span></span>';
        $html .= '<span class="entry-comment">' . $write_comments . '</span>';
        $html .= '</div>';
        $html .= '<a href="' . get_the_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID, $imagesize);
        $html .= '</a>';
        $html .= '</div>';
        $html .= '<div class="des-container">';
        $html .= '<span class="post-date3"><span class="day">' . get_the_date('d', $post->ID) . '</span><span class="month">' . get_the_date('M', $post->ID) . '</span></span>';
        $html .= '<span class="post-date"><span class="day">' . get_the_date('d', $post->ID) . '</span><span class="month">' . get_the_date('M', $post->ID) . '</span></span>';
        $html .= '<div class="post-info">';
        $html .= '<h3 class="post-title"><a href="' . get_the_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></h3>';
        $html .= '<div class="post-excerpt">';
        $html .= road_excerpt_by_id($post, $length = $atts['length']);
        $html .= '</div>';
        $html .= '<a class="readmore" href="' . get_the_permalink($post->ID) . '">' . esc_html($road_opt['readmore_text']) . '<i class="fa fa-arrow-right"></i></a>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
    }
    $html .= '</div>';
    wp_reset_postdata();
    return $html;
}