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:
<?php // Morfy::factory()->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 '<h3><a href="'.$config['site_url'].'/blog/'.$post['slug'].'">'.$post['title'].'</a></h3> <p>Posted on '.$post['date'].'</p> <div>'.$post['content_short'].'</div>'; } ?>
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;