Jump to content

Recommended Posts

Posted

What's the best way to exclude the current page from results without resorting to filtering the results in a FOR LOOP.

$news = $pages->find("template=news-article,sort=-publish_date, publish_date<$today"); 

In this example If I want to exclude the current page how would I do that?  

Is there a sibling reference?

Posted
24 minutes ago, maddmac said:

In this example If I want to exclude the current page how would I do that?  

$news = $pages->find("template=news-article,sort=-publish_date, publish_date<$today,id!={$page->id}"); 

PS: if publish_date is a datetime field, then ProcessWire already knows 'today' (string) ?

  • Like 3
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...