Last_posts = array(
'numberposts' => 3,
'post_status' => 'publish',
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'post_content' => '',
);
$result = wp_get_recent_posts($Last_posts);
foreach( $result as $p ){
$d = "Y/m/d";
$pd = get_the_date( $d, $p['ID'] );
$trimmed_content = mb_strimwidth( $p['post_content'],0, 130, "..." ); //Ограничение в 130 символов
if( has_post_thumbnail($p['ID']) ) // Если не будет картинки ставим заглушку
{
$thumbnail = get_the_post_thumbnail_url($p['ID'], large); //Подгрузка картинки поста
}
else
{
$thumbnail = get_bloginfo("template_url").'/no-image.png"'; //Подгрузка заглушки из директории шаблона
}
}
$sReview = array(
'number' => 3,
'orderby' => 'comment_date',
'order' => 'DESC',
'status' => 'approve',
'type' => '',
);
if( $comments = get_comments( $sReview ) ){
$d = "Y/m/d H:i";
foreach( $comments as $comment ){
$comment_date = get_comment_date( $d);
}
}
function postsCarousel() {
var checkWidth = $(window).width();
var owlPost = $(".owl-carousel-news");
if (checkWidth > 767) {
if(typeof owlPost.data('owl.carousel') != 'undefined'){
owlPost.data('owl.carousel').destroy();
}
owlPost.removeClass('owl-carousel');
} else if (checkWidth < 768) {
owlPost.addClass('owl-carousel');
owlPost.owlCarousel({
items:1,
dots:false,
loop:true,
touchDrag : false,
mouseDrag : false,
smartSpeed: 700,
nav:true,
navText: ['<i class="flaticon-back"></i>','<i class="flaticon-next"></i>']
});
}
}
postsCarousel();
$(window).resize(postsCarousel);
display:none;