Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-02-20 15:45:05

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

REQ: article posted="today" ???

I wish, that both txp:article and txp:article_custom
would be able to have their posted attribute set to “today”
- regardless of the current hour actually.

Last edited by jayrope (2023-02-20 15:46:36)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#2 2023-02-20 17:32:00

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: REQ: article posted="today" ???

would this work for you?

<txp:variable name="posted-day"><txp:php>echo safe_strftime("%b %d, %Y");</txp:php></txp:variable>
<txp:if_variable name="posted-day" value='<txp:posted format="%b %d, %Y" />'>
<txp:posted />
<txp:else />
Today
</txp:if_variable>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2023-02-20 21:06:22

etc
Developer
Registered: 2010-11-11
Posts: 5,210
Website GitHub

Re: REQ: article posted="today" ???

Try also this:

<txp:article month="today" time="%Y-%m-%d" />

Offline

#4 2023-02-23 18:36:56

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: REQ: article posted="today" ???

Thank you very much, Yannis and etc.

I went with etcs method. It does work here with an article_custom tag.
But why and how exactly?
The txp tag docs don’t give me any clue there…


A hole turned upside down is a dome, when there’s also gravity.

Offline

#5 2023-02-23 21:37:14

etc
Developer
Registered: 2010-11-11
Posts: 5,210
Website GitHub

Re: REQ: article posted="today" ???

The docs vaguely mention time and month attributes, awaiting a better description by someone (why not you? :-)

Offline

Board footer

Powered by FluxBB