Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Today 08:23:58

abu
New Member
From: Switzerland
Registered: 2025-04-03
Posts: 5
GitHub GitLab Mastodon

Using article_custom with attribute month

I detected that

<txp:article_custom section='articles' month='2025-07' />

works as documented, but putting the month in a variable

<txp:article_custom section='articles' month="<txp:variable name='d' />" />

doesn’t.

What is the official or recommended way to use the month attribute with variable values?
Are there any usage examples available?

Offline

#2 Today 11:22:41

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,956
Website GitHub

Re: Using article_custom with attribute month

Try switching the quotes around. Use single quotes to denote “process the contained tag and puts its result here”, otherwise double quotes for normal attributes.

<txp:article_custom section="articles" month='<txp:variable name="d" />' />

And your variable d should take the form YYYY or YYYY-MM. You can use the format attribute to output dates in other formats using strftime notation, e.g. format="%Y-%m"


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB