Is it somehow possible to show/hide some php after day of week? I have some content I would like to show from monday-friday and then hide it and show some other content saturday-sunday. I'm using Joomla and the plugin that makes it possible to write php codes directly in the articles.
So I actually have one article I would like to show from monday-friday and another article to show saturday-sunday and then repeat every week. I've tried to find a way to just switch article, but I can't do that without publish/unpublish manually every week. So I thought about writing both articles together and then hopefully be able to switch between the code in the article depending on the day of week.
Possible? I'm not that good at php so please bear over with me :) Thank you
Using PHP - you can use the Date() function to get the current day of the week as an integer, and from there show different content.
$w = date("w");
if ($w > 0 && $w < 6) {
//Show weekday content
} else {
//Show weekend content
}
If you go with a JavaScript solution, however, the Date() function will return the local time of the user, as opposed to the server's local time that you would get with PHP.