Forum

Thread tagged as: Question, Blog

List of blog posts

Hi All

I have just created a new post type called photo.html

and on my blog page i want to display my photo.html in a different style to my default post type

How can i do this using post_in_list.html

Anthony Elleray

Anthony Elleray 2 points

  • 5 years ago

Yes, you can do that by changing the post_in_list.html (or creating your own template in the blog's templates folder).

Then you specify which template by using perch_blog_custom in your page, like so:

<?php
perch_blog_custom(array(
    'template' => 'post_in_list.html',
));
?>

For more information, see here: https://docs.grabaperch.com/addons/blog/page-functions/custom/

What if I want one list displaying both post types And a template or each post type

The best way is to probably use <perch:if> to match the type.

So have one template, output two styles:

<perch:if id="category" match="eq" value="x">
Put the template code for first category
<perch:else />
<perch:if id="category" match="eq" value="y">
Put the template code for second category
</perch:if>
</perch:if>

I've used categories as an example, but you just match the id you want to filter posts by. More information on perch if statements here: https://docs.grabaperch.com/docs/templates/conditionals/if/