Hello everyone,
I am trying to do get the latest posts that are NOT hidden(Show in Menus? is unchecked). Right now the get() I do below returns all published pages. I just need to omit pages that are hidden from the result.
Below is my controller code and template code:
Page.php Controller Code:
public function LatestEvents($num=3) {
$events = DataObject::get_one("EventListing");
return ($events) ? DataObject::get("EventPage", "ParentID = $events->ID", "Date DESC", "", $num) : false;
}
Template Code/Loop:
<% control LatestEvents(4) %>
<li><% if MultipleDates %>$MultipleDates<% else %>$Date.Format(n.j.y)<% end_if %><p><a href="$Link" title="Read more on "{$Event}"">$Event</a></p></li>
<% end_control %>