Topic: Last 5 posts

hi
how can I have the last 5 post

Re: Last 5 posts

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'].'
'; } ?>
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: Last 5 posts

who should add this code;

Re: Last 5 posts

This is for Blog template  if you need for other just change the name of folder.

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: Last 5 posts

smile

Re: Last 5 posts

I have 5 categories
example: blog, blog1, blog2, blog3, blog4
how can I have the last 5 post from 5 categories;

7 2014-11-16 21:45:01

Re: Last 5 posts

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);
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: Last 5 posts

need to show only 5 last post from 5 categories to homepage
way to do this;