Jump to content

Schedule to publish one page per day


mjut
 Share

Recommended Posts

Hi forum,

I don't really know how to do this: I want to create multiple (not published but saved) pages. From that on, I want the pages to be published each page a day aromatically.
I am sure, this is possible.. But where do I begin?

Thanks for suggestions and input.
Cheers

Stephan

 

 

Link to comment
Share on other sites

Here is the script:

#!/usr/bin/php
<?php namespace ProcessWire;
include("/home/stephan/www/index.php");
foreach ($pages->find("template=post, status=unpublished, sort=unpublished, limit=1") as $post)  {
		$post->removeStatus('unpublished');
		$post->addStatus('published');
		$post->save();
	}

With cron it is triggered once a day and it will look for unpublished posts. If there are any, the oldest post will get published.

Simple as that.

 

I am using this script to update my photo blog https://photos.stephansimonis.com more regularly. 😉

  • Like 3
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...