4.4.1@stable:
Question:
Filter a specific page type by ClassName from the SiteTree, and sorted the “LastEdited“ by the DESC.
Loop the $LatestUpdates on the template, the order of last edited pages are not correct. But if you logged in and view the page with ?stage=Stage in your URL, the page is showing the correct order.
function getLatestUpdates()
{
$pages = SiteTree::get()
->filter('ClassName', 'App\\PageTypes\\ContentPage')
->sort('LastEdited', 'DESC')
->limit(3);
return $pages;
}
Please have a look, is there anything wrong with my code?