Forum

Thread tagged as: Question

category id

I want the categories in a post to display and the url to as below to go back to the archive and apply a filter. however the filter needs to filter by that category id number not its name.

<perch:categories id="categories" set="blog" label="Categories" display-as="checkboxes">
   <a href="archive.php?#filter=.<perch:category id="catSlug" type="slug" />" class="p-category">
      <perch:category id="catTitle" type="text" />
   </a>
</perch:categories>
Timothy Rackham

Timothy Rackham 0 points

  • 5 years ago

If I understand what you are after, I think you could use catID:

<perch:categories id="categories" set="blog" label="Categories" display-as="checkboxes"> <a href="archive.php?#filter=.<perch:category id="catID" />" class="p-category"> <perch:category id="catTitle" type="text" /> </a> </perch:categories>

I find it's always helpful to throw a <perch:showall/> into a template to see what you have available to work with