Forum
No " Archive of " heading for blog categories -- changed catSlug to catPath to d...
I'm trying to set up an archive page for categories and sub-categories.
I see that in order to display the archive of sub-categories I must change id="catSlug" to id="catPath". I've made those changes to my category links everywhere, and the sub-categories now appear in an archive, however it has broken the "Archive of:" heading display.
I'm using the standard:
if (perch_get('cat')) {
echo '<h1>Archive of: '.perch_blog_category(perch_get('cat'), true).'</h1>';
perch_blog_custom(array(
'category' => perch_get('cat'),
'template' => $template,
'count' => $posts_per_page,
'sort' => $sort_by,
'sort-order' => $sort_order,
));
$posts_displayed = true;
}
I've tried to pass in a few different arguments for:
'.perch_blog_category(perch_get('cat'), true).'
I've not had any luck getting the heading to populate with the proper category or sub-category title.
Thanks for the assist!
What's the value of
cat
on your query string?So it looks like when I use
id="catSlug"
it'scat=design
(design being a parent category); this displays the parent title and post properly, but no sub-cat titles or posts.When I switch to
id="catPath"
(enabling display of both cat and sub-cat posts), it'scat=blog/design/interiors/
I get the sub-cat posts but no titles. If just delete "blog/" from the string in the browser the sub-cat title shows up, but with no posts.
Instead of
perch_blog_category
tryperch_category
.Thanks Drew, this will work.
With
echo '<h1>Archive of: '.perch_category(perch_get('cat'),true).'</h1>';
the category and sub-category posts come in properly, but the cat / sub-cat titles come in above, not in line with, the "Archive of:" header.Figured that's because these cat titles are now controlled by
perch/templates/categories/category.html
.I created a new template
blog_cat_archive.html
inperch/templates/categories/
. I copied the defaultcategory.html
template located there, but I stripped the container elements (ul li h4
) so the output is just the category title. This seems to fix the issue. I'm getting the posts, and titles where they should be (inline with "Archive of:")This is the new code and template: