I want to output a list of Category A's child categories, then at the end of that list, display a link to Category A itself (.review
):
<h1>Category A</h1>
<ul class="readings">
<li><a href="topics/readings/cat-child-1">Category Child 1</a></li>
<li><a href="topics/readings/cat-child-2">Category Child 2</a></li>
<li><a href="topics/readings/cat-child-3">Category Child 3</a></li>
<li class="review"><a href="topics/review/category-a">Category A Review</a></li>
</ul>
Basically just an upside-down category list. So I did this with GW Code Categories:
{exp:gwcode_categories
cat_url_title='{segment_2}'
style='linear'
show_empty='no'
}
{if depth2_start}
<h1>{cat_name}</h1>
<ul class="readings">
{/if}
{if depth == 3}
<li><a href="{path='topics/readings/{cat_url_title}'}">{cat_name}</a></li>
{/if}
{if depth2_end}
<li class="review"><a href="{path='topics/review/{cat_url_title}'}">{cat_name} Review</a></li>
</ul>
{/if}
{/exp:gwcode_categories}
This almost works perfectly, except for the .review
list item at the end. Instead of displaying the URL and name of Category A (depth2
), it displays the URL and name of the last child category (depth3
).
What am I missing here?