Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-06-02 13:29:00

towndock
Member
From: Oriental, NC USA
Registered: 2007-04-06
Posts: 333
Website

if day of the week =

I’m in the midst of a restaurant site.

I want to display content based on the day of the week. Not date – day.

Example:

If Tuesday:
Tuesday menu

If Wednesday:
Wednesday menu

etc.

If there is a built in obvious way to do this, I’ve missed it. A <txp:if_day /> tag doesn’t seem to exist. I haven’t found a plugin thus far.

Ideas?

Offline

#2 2013-06-02 13:37:16

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

Re: if day of the week =

<txp:etc_if_date value="2" format="%u">
	Tuesday menu
</txp:etc_if_date>

Edit: changed format, sorry.

Last edited by etc (2013-06-02 17:55:29)

Offline

#3 2013-06-02 13:44:31

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

Re: if day of the week =

Here is an untested solution without a plugin

<txp:variable name="weekday" value='<txp:php>echo date('D');</txp:php>' />
<txp:if_variable name="weekday" value="Mon">
Monday menu
</txp:if_variable>
<txp:if_variable name="weekday" value="Tue">
Tuesday menu
</txp:if_variable>

... etc

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

Offline

#4 2013-06-06 15:22:11

towndock
Member
From: Oriental, NC USA
Registered: 2007-04-06
Posts: 333
Website

Re: if day of the week =

etc Oleg – that plugin works. Problem solved – thank you for the simple solution.

Keith

Offline

Board footer

Powered by FluxBB