Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display subcategories in news templates #211

Open
mrbjoernson opened this issue Mar 11, 2022 · 1 comment
Open

Display subcategories in news templates #211

mrbjoernson opened this issue Mar 11, 2022 · 1 comment

Comments

@mrbjoernson
Copy link

This page explains how to display all categories in a news template.
https://github.com/codefog/contao-news_categories/blob/master/docs/template-adjustments.md

Is it also possible to display only the categories from a subcategory in this way?

For example only the categories from the subcategorie Sports
Bildschirmfoto 2022-03-11 um 14 36 54

@jaynoe
Copy link

jaynoe commented Sep 14, 2022

Hey there, dont know if this is relevant anymore - but maybe you can do this with the NewsCategory Model?
https://github.com/codefog/contao-news_categories/blob/master/src/Model/NewsCategoryModel.php

use Codefog\NewsCategoriesBundle\Model\NewsCategoryModel;

$sportsCategory = NewsCategoryModel::findPublishedByPid(1); // or other id from the main category

Then fetch the data and loop through it. Not tested btw ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants