page publish and unpublished scheduler

Recommended Posts

I've a promotion page that i  want to show on scheduler bases, Lets say i want my page "XYZ" should publish on Thu, 18 at 12:00am and unpublished on Web, 25 at 12:00am. 

is it possible in processwire?

Share this post

Link to post
Share on other sites

I actually have done something similar on a project using the Date/Time, and at the time, a checkbox. However, I have since moved it to 2 Date/Time fields. I simply compared the two, and used an if statement to display the page content if the condition was met. This is rough, but it is similar to what I have done:

$startdate = $page->start_date;
$expirationdate = $page->expiration_date; //you will probably need to use strtotime on these to compare.

if ($startdate <  $expirationdate) {
	//show the desired information
else (
	echo "We're sorry, there are currently no promotions availabe.";

However, I guess this might not suite your needs since the page will still be visible, unless you do some checking in your navigation to show/hide the url with a conditional.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.