Forum
perch_blog_post_categories doesn't load template
I am very new to perch and not yet familiar with what is Perch and what is Perch runway.
I added the blog addon and I'm trying to display the categories of each blog post, but perch_blog_post_categories()
is only loading the default template?
perch_blog_custom(array(
'template' => 'post_in_list.html',
'each' => function($item) {
$item['categories'] = perch_blog_post_categories($item['postID'], 'post_in_list_category.html', true);
return $item;
}
));
Can anyone help me find out why this the template that is being loaded is always post_category_list
and to the one I am passing?
If it is a Perch Runway thing I think it should be stated clearly in the documentation.
Thanks
You don't need to use a callback for this. In your
post_in_list
template, add theperch:categories
tag pair from yourpost.html
template.Something like:
Thanks for answering so fast but I think I did not make myself very clear with the description.
What I want to achieve is to have listed each of the categories of a given post, not just all categories. which Is what I think you are telling me to do...
The code Drew has given you is to list the categories for an individual post.
You can see the same code in your post.html Master Template which relates to a single post.
Worked like a charm! thank you guys for the support!!!!