Forum

Thread tagged as: Question, Problem, Addons

Help With Portfolio using Categories

So I have a Portfolio using a listing page and detail page. Currently using this to display the listing in the listing page:

<?php perch_content_custom('Portfolio', array(
    'category' => perch_get('cat'),
    'template' => 'portfolio_listing.html',
    ));
?>

So that displays everything if I use www.mywebsite/gallery/

Now I want to create a separate listing page to just display a specific category.

I have a category set called 'gallery' and within it 3 categories 'Donation Envelopes', 'Bangtail Envelopes', 'Direct Mail Envelopes'

So tried this:

www.mywebsite?cat=gallery/donation-envelopes/

But none of the portfolio items or their container display, the page container displays.

I just need a way to display a pre-filtered gallery listing.

Nigel Coath

Nigel Coath 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it work if you enter the category path directly rather than via the URL?

If you mean /gallery/donation-envelopes then no

Drew McLellan

Drew McLellan 2638 points
Perch Support

No I mean:

perch_content_custom('Portfolio', array(
    'category' => 'gallery/donation-envelopes',
    'template' => 'portfolio_listing.html',
    ));

i.e. have you taken some basic steps to find the root of the problem?

If I add that there is no gallery content. So something is wrong with the categories.

I am using an isotope method to display the gallery which uses a class to filter items. So I set up a way to generate the class depending on the category chosen when adding an item.

This is what is in the category_single template:

<perch:category id="catTitle" type="smarttext" label="Title" required="true" />
<perch:category id="catClass" type="smarttext" label="Class" required="true" />
<perch:category id="catSlug" type="slug" for="catTitle" suppress="true" />

The in my portfolio_listing template its called using:

<perch:categories id="Portfolio" label="Category" set="gallery">
<div class="w-portfolio-item <perch:category id="catClass"/>">
</perch:categories>

This works fine and does the job. However my client wants a link to a pre filtered gallery. I have tried doing this by using a method called hash history but its a bit beyond me. So I thought about using the same template but predefining the category on a link to it and serving an alternate listing template without the filter links.

However it seems there is an error in the category being assigned?

How do I find the error?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Which problem are you trying to solve first?