Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

List any parent categories under each discussion

When on the discussions page, it would be fantastic if discussions could list the parent category as well as the child category.

If you have child categories with the same names, it can be confusing for visitors as to what the discussion relates to when you are on the forum homepage which lists all the discussions:


TV Show 1/Episodes
TV Show 2/Episodes

Under the discussions it just says "Episodes".

It would be great for it to say "TV Show 1" and then "Episodes" (i.e. a breadcrumb like you see when you are on the category pages).

I know the file I need to edit is themes/mytheme/views/discussions/helper_functions.php:

echo Wrap(Anchor($Discussion->Category, '/categories/'.$Discussion->CategoryUrlCode, 'Category'));

And the code I could probably adapt from exists elsewhere in that same file (for showing the breadcrumb on the category pages):

<?php $DescendantData = GetValue('DescendantData', $Sender->Data); $Category = GetValue('Category', $Sender->Data); if ($DescendantData && $Category) { echo '<div class="SubTab"><span class="FirstCrumb">?~F? </span>'; foreach ($DescendantData->Result() as $Descendant) { // Ignore the root node if ($Descendant->CategoryID > 0) { echo Anchor(Gdn_Format::Text($Descendant->Name), '/categories/'.$Descendant->UrlCode); echo '<span class="BreadCrumb"> &rarr; </span>'; } } echo $Category->Name; echo '</div>'; } ?>

However, $DescendantData = GetValue('DescendantData', $Sender->Data); doesn't return anything when copied into the code for the discussion category display area.

Any ideas as to how I can get that working?


  • Options
    Anyone have any suggestions for this?
  • Options
    No, best thing is to make top and bottop paths ala XenForo.
    As this helps with SEO and representation in search also.
Sign In or Register to comment.