$nb_posts, 'category' => $category);
$recent_posts = wp_get_recent_posts( $args );
$html = '';
foreach( $recent_posts as $recent ){
$content = strip_tags($recent['post_content']);
$title = strip_tags($recent['post_title']);
$content_len = strlen($content);
$title_len = strlen($title);
$img_id = get_post_thumbnail_id($recent['ID']);
$img_attrs = wp_get_attachment_image_src($img_id, 'medium');
$img_src = $img_attrs[0];
$wimg = $img_id > 0 ? true : false;
$title_str = $title_len > 50 ? substr($title, 0, 47) . '...' : $title;
if ($wimg == true) {
$wimg_class = 'wimg';
if ($title_len > 28 ) {
$content_str = $content_len > 107 ? substr($content, 0, 100) . ' ... more' : $content;
} else {
$content_str = $content_len > 220 ? substr($content, 0, 213) . ' ... more' : $content;
}
} else {
$wimg_class = '';
if ($title_len > 28 ) {
$content_str = $content_len > 600 ? substr($content, 0, 592) . ' ... more' : $content;
} else {
$content_str = $content_len > 700 ? substr($content, 0, 692) . ' ... more' : $content;
}
}
$html = $html . ''
. ( $img_id > 1 ? '' : '')
. ' '
. $content_str
. ''
. $title_str
. '
'
. '