Craft CMS Asked on July 28, 2021
I’m trying to display a notification badge on how many new entries were posted today only. But I cannot get the following to work.
{% set timeAgo = now|dateModify('today') %}
{% set recentMerchantsOffers = craft.entries.section('offers').postDate(timeAgo).relatedTo(recentMerchants) %}
Any help would be great 🙂
I'm not sure what recentlyViewed()
is and what it returns but to query today's entry, you can do:
{# Today in atom format #}
{% set timeAgo = date('today') | atom %}
{% set recentMerchantsOffers = craft.entries()
.section('offers')
.postDate(">= #{timeAgo}")
.all() %}
Correct answer by Oli on July 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP