Forum

Thread tagged as: Question, Problem, Blog

Blog - Post-in-list options

Hi,

In a home page layout I've got a section that shows latest 3 blog posts' section. The html for the first (most recent) post (template post-in-list-homepage1.html) is different to the html for other 2 posts (template post-in-list-homepage2.html, hence why I'm using 2 separate templates. Looking at the perch_blog_custom options array I am not sure if what I want to do is achievable.

It's easy enough to select the latest post in the first template but how do I select the next 2 recent posts in the 2nd template? I thought about using the 'start' option but that only allows you to select by a post id and not, for example, the 2nd most recent article.

Here is my home page (index.php) as it stands:

    perch_layout('global.header');
    perch_content('Home Slider');
    perch_content('Home Main Content');

    perch_blog_custom(array(
        'count'      => 1,
        'template'   => 'post_in_list_homepage1.html',
        'sort'       => 'postDateTime',
        'sort-order' => 'DESC',
        ));
    perch_blog_custom(array(
        'count'      => 2,
        'template'   => 'post_in_list_homepage2.html',
        'sort'       => 'postDateTime',
        'sort-order' => 'DESC',
        ));

    perch_layout('global.footer');

Any suggestions?

Neil Duddridge

Neil Duddridge 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Use:

'start' => 2,
'count' => 2,
'paginate' => false,

Perfect.