Forum
Get category name from slug
I have a page that's filtering a few projects based on a couple of categories. Built it using the listing/details and filter by category solutions.
When a filter is active and I've got a slug set in the url (for use with content_custom and perch_get), is there a way to fetch the category name based on the slug so I can clarify for the user which category is active at the moment?
You can use
perch_category()
to get everything back for a category. Pass it the category path, e.g.Ah, got it to work using a template.
Also tried using skip-template and raw to get the category info into an array for easier handling but that wouldn't do quite well. Adding true after the options array while supplying a template worked but is this the way to go?
Yes, that should do it.