Search
Other Articles Anywhere questions
Forum

Show articles with a custom date field "equal and bigger than today"

Seppi's Avatar Seppi
Hi

We have a custom field where content managers can enter a date (d.m.Y). Now we'd like to show all these articles minus the ones in the past.

But we can't figure out the right Articles Anywhere syntax. Here's what we tried:
{articles category="178" custom-date-field="date('today') to date('+365 days')" ordering="custom-date-field ASC" pagination="true" per_page="5"}

(content)

{/articles}

But this will also show all the dates in the past. We're sure there's a smarter way to do this anyway, but couldn't figure it out using the manual:
docs3.regularlabs.com/articlesanywhere/p...alues-relative-dates

Do you have a hint for us?

Thanks & best regards
Peter van Westen's Avatar Peter van Westen ADMIN
Is this custom field a calendar field? Or a simple text field?
The date ranges only work on fields that are stored as actual dates in the database (yyyy-mm-dd with optional time: hh:mm:ss).
Please post a rating at the Joomla! Extensions Directory
Seppi's Avatar Seppi
Hi Peter, thanks for the fast reply.

Yes, it's a calendar field. It seems to be stored as actual dates, because when I type
output="value"
it will output (for example) 2021-08-27 22:00:00.
Peter van Westen's Avatar Peter van Westen ADMIN
Can you give me (super) admin and (s)ftp access so I can take a look?
And tell me on what url I can see/reproduce the issue.
You can use the 'Confidential information' button in the forum editor to hide sensitive information.
Please post a rating at the Joomla! Extensions Directory
Seppi's Avatar Seppi
Hi Peter

It's the most embarassing thing, but I just re-added the syntax mentioned in the original post so you can see the issue. And guess what, now it works. So it was obviously my mistake (` instead of ' or something like that ...?).

So sorry to have bothered you! Super user and FTP accounts were already ready for you 😉.

Confidential information:
(hidden)


Anyway, thanks again for your great support and of course for this outstanding component!

Best regards
Peter van Westen's Avatar Peter van Westen ADMIN
Ok, great you have it working now! ?
Please post a rating at the Joomla! Extensions Directory
Seppi's Avatar Seppi
Hello Peter

Sort of a follow-up question here - if you can spare the time. Is it possible to show the 4 future articles closest to the current date and then if some "pass" the current date, show the ones from the past (if there aren't 4 in the future anymore)?

So if today is the 30st of August and we have these articles:
- 9th of September
- 8th of September
- 3rd of September
- 2nd of September

Then let's say today is the 4th of September and there aren't any Articles after the 9th, it still shows the 3rd and the 2nd of September instead. Do you know what I mean?

I just don't seem to have enough "memory" in my head to figure this out using the manual ?. But I suspect you do ... but no hurries!

Best regards
Peter van Westen's Avatar Peter van Westen ADMIN
I don't see how Articles Anywhere could manage that is a single tag.
I recommend you solve this via custom php. At least to get the list of article ids, which you could then pass to the Articles Anywhere tag.
Please post a rating at the Joomla! Extensions Directory
Seppi's Avatar Seppi
OK, so at least I know it wasn't my lack of intelligence 😉. Thank you!

Cheers
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription