I am currently trying to make a e-zine using wordpress, and have most of it done. The homepage displays a list of the “pieces” which are included in that edition of the e-zine. I would like to make it so that, when an edition expires (currently using Post Expirator plugin), a new page is created automatically resembling the front page in showing the index of that particular (now expired) edition.
I’m not very experienced using PHP, and still a newbie at wordpress. How could I accomplish this?
Here is what I ended up doing, using the suggestions of Felipe as a starting point. There might be a less convulted way of doing this, but, as I said, I’m just a beginner, so this is what I came up with:
First, I created a volnum variable, which keeps track of the current volume number. Then, I cache the front page so that later I can save it as an independent html document:
This is at the beginning of the index.php, before the get_header().
In the front page, I have an editorial and, next to it, I have the content index. I am saving the editorial tag’s (which is always “voln” where ‘n’ is the volume number) volume number (maybe the foreach is not necessary since the editorial only has one tag) :
Finally, at the end of the document, after the last html, I have added the following code:
“past_vol” is the directory where I am saving the past volume html files. So the directory is opened, the amount of files is counted, and a loop that goes through each file’s name is started. If a file with the same name as $volnum, then $volExists is true. If at the end of the loop $volExists is false, then it saves the cached page.
Again, it could probably be optimized a whole lot, but for now this works!