a-ok Posted June 14, 2016 Share Posted June 14, 2016 I'm wanting to return pages of the current year only. I have a date field set up 'article_detail_date'; but unsure how to write this into the pages selector. $pages->find("parent=articles, sort=article_detail_date"); I'm also curious to know whether you can do it between two years; and also exclude a specific year. My thinking would be... $current_year = date('Y'); $article_year = article_detail_date('Y'); $pages->find("parent=articles, sort=article_detail_date, article_year=current_year"); Only thing is '$article_year' isn't working as it's before the loop... Any ideas? Thanks! Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 14, 2016 Share Posted June 14, 2016 There's no support for (mysql) date functions in the selector engine. You need to go this way: $startOfYear = mktime(0,0,0,1,1,date('Y')); $endOfYear = mktime(23,59,59,31,12,date('Y')); $pages->find("…, article_detail_date>=$startOfYear, article_detail_date<=$endOfYear"); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now