I have site with menu:
Home
Category1
---Subcategory
---Subcategory
---Subcategory
Category2
---Subcategory
---Subcategory
---Subcategory
Category3
---Subcategory
---Subcategory
---Subcategory
Category4
---Subcategory
---Subcategory
---Subcategory
Subcategories have news, but all news are visible only in parent category. Subcategories are hidden on page. I use in CategoryPage.php code :
$pageIDs = $this->getDescendantIDList();
$doSet = DataObject::get(
$callerClass = "News",
$filter = "`CategoryPageID` IN (" . implode(",", $pageIDs) . ")" . $filterStatement,
$sort = "Created DESC",
//$sort = "RAND()",
$join = ""
);
It list all news from subcategories on category page.
Now I want put on home page 4 modules with a few news from each category. How can I change this code to work?
Code:
$doSet = DataObject::get(
$callerClass = "News",
$filter = "`CategoryPageID` = '7'" . $filterStatement,
$sort = "ID DESC",
$join = ""
);
give me news from only one subcategory.
sSomeone can help me?