This is a snippet for Umbraco 8 to Order a collection by a Custom Field Such as a Date. @{ var selection = Umbraco.Content(Model.Id) .ChildrenOfType("publication") .Where(x => x.IsVisible()) .OrderBy( x => x.Value("publicationDate")); } @foreach (var item in selection.Take(1)) { <h2><a href="@item.Url" title="@item.Name">@item.Name</a></h2> }
Mark Downie - Umbraco 7 and Umbraco 8 (and umbraco 4) Developer - Code Snippets - Glasgow - Scotland
I am Mark Downie a web developer who uses the Umbraco CMS. You can see examples of my Umbraco web sites at: http://www.markdevelopment.co.uk If you have any questions, please contact me. Thanks