Topic: Last 5 posts
hi
how can I have the last 5 post
You are not logged in. Please login or register.
hi
how can I have the last 5 post
See the blog code:
getPages($url,$order_by,$order_type,$ignore,$limit);
// $url is a folder of posts
$url = CONTENT_PATH . '/blog/';
// $order_by is a order like date or title
$order_by = 'date';
// $order_type is a order type like ASC or DESC
$order_type = 'DESC';
// $ignore = array of files to ignore
$ignore = array('404','index');
// $limit is a number of posts
$limit = 5;
$posts = Morfy::factory()->getPages($url,$order_by, $order_type,$ignore,$limit);
foreach($posts as $post) {
echo ''.$post['title'].'
Posted on '.$post['date'].'
'.$post['content_short'].'';
}
?>who should add this code;
This is for Blog template if you need for other just change the name of folder.
![]()
I have 5 categories
example: blog, blog1, blog2, blog3, blog4
how can I have the last 5 post from 5 categories;
why not use tags plugin of Tovic and add in Morfy::factory()->getPages in end add 5 like this
$posts = Morfy::factory()->getPages(CONTENT_PATH . '/blog/', 'date', 'DESC', array('404','index'),5);need to show only 5 last post from 5 categories to homepage
way to do this;