Forum

Thread tagged as: Question, Problem, Addons

Problems filtering content with categories

I've got a single page for listing projects and details about them, made after the "list and detail page in Perch" solution.

Now I'm trying to combine that solution with the filter categories solution, as my content has got some categories added to it. Problem is that I just can't get it to work. When setting a category slug in the url the page doesn't show any content at all, zero projects found if you will. Rest of the page renders just fine.

Excuse the swedish, trying to keep the slugs and all intact. ?category=school, pretty much. Think you'll get it.

My url is: /projekt.php?kategori=skola

perch_content_custom('Projekt', array(
  'template' => 'Projektlista.html',
  'category' => perch_get('kategori')
));

Images as well, showing the contents category and the school(skola) category details from :showall The contents categories Details of the school category

Is it even possible to combine these solutions or am I just getting things wrong and mixed up?

Jonas Edvardsson

Jonas Edvardsson 0 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Have you tried enabling debug to see what is happening?

https://solutions.grabaperch.com/development/how-do-i-debug-problems

No, but I just tried it.

Correct template, which would be the same as without any category specified. No SQL errors as far as I can see.

Debug

Tried a raw skip-template plus the category and it returns an empty array, so it seems like Perch has trouble finding content with the matching category.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to use a category path, e.g. set-slug/category-slug

That did it, thanks a lot! :)