if (end($cat)->slug == 'all') {
$articles = get_posts([
'post_type' => 'post',
'post_status' => 'publish',
'numberposts' => -1,
]);
} else {
$articles = get_posts([
'post_type' => 'post',
'post_status' => 'publish',
'numberposts' => -1,
'category' => end($cat)->term_id
]);
}
foreach ($articles as $art) {
echo '
'.$art->post_title.'
';
foreach (get_the_category($art->ID) as $aDet) {
echo '- '.$aDet->name.'
';
}
echo '
'.date('d/m.Y',strtotime($art->post_date)).'
'.substr(strip_tags($art->post_content),0,150).'
';
}
?>