0

I'm trying to use GWcode Categories to output category last child url for an entry. Code looks like:

    {exp:channel:entries channel="products" category="{segment_2_category_id}" orderby="title" sort="asc" limit="8" status="open" paginate="bottom" dynamic="no"}

    <div class="col-md-3 col-sm-6 category-item">
        {exp:gwcode_categories group_id="1" url_title="{last_segment}" last_only="yes"}
        <a href="{site_url}{segment_1}/{segment_2}/{cat_url_title}/{url_title}">
            {product_image limit="1"}<img src="{product_image:image}" alt="{product_image:title}" class="img-responsive">{/product_image}
            <h3>{title}</h3>
        </a> 
        {/exp:gwcode_categories} 

    </div>
    {switch='|||</div><div class="row row-category">'}

    {/exp:channel:entries}

but what I'm getting is a list of all last child categories urls from the group 1.

Any clue how to get last child category url per listed entry?

Thanks

0

Well, user error - fix was very easy - use entry_id instead of title_url:

    {exp:channel:entries channel="products" category="{segment_2_category_id}" orderby="title" sort="asc" limit="8" status="open" paginate="bottom" dynamic="no"}

    <div class="col-md-3 col-sm-6 category-item">
        {exp:gwcode_categories group_id="1" entry_id="{entry_id}" last_only="yes"}
        <a href="{site_url}{segment_1}/{segment_2}/{cat_url_title}/{url_title}">
            {product_image limit="1"}<img src="{product_image:image}" alt="{product_image:title}" class="img-responsive">{/product_image}
            <h3>{title}</h3>
        </a> 
        {/exp:gwcode_categories} 

    </div>
    {switch='|||</div><div class="row row-category">'}

    {/exp:channel:entries}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.