Change A Post Date

Find help with FlatPress plugins, report a plugin bug, request or present new plugins.
Post Reply
NorfolkGreg
Posts: 26
Joined: Wed Dec 30, 2020 9:58 pm

Change A Post Date

Post by NorfolkGreg » Mon Jun 14, 2021 11:27 pm

Can I change the date or time of a post simply by placing the entry file in the appropriate year and month folder and giving it a name that reflects the new date and time?

Do I need to edit any other file to ensure the entries remain indexed properly?

NorfolkGreg
Posts: 26
Joined: Wed Dec 30, 2020 9:58 pm

Re: Change A Post Date

Post by NorfolkGreg » Tue Jun 15, 2021 8:38 am

Perhaps I should explain...

After a 6 month break I'm back checking out what FlatPress has to offer. After my post above I explored the available plug-ins and see there are a couple of Date Changers available. Both only allow to set a non-current date on creation of the entry. I can see that for 99.9% of users that's all that would ever be required and, probably, I will count within that 99.9%.

So the question is more theoretical than practical and came to mind having recently moved another of my blogs which had many daily posts to a new platform. In doing so I decided to merge a set of near daily posts into a single weekly one dated on a regular day of the week. So, long after posting, I needed to change the original date and add further content to a post. In considering how I would do that in FlatPress I was being a bit dim! Obviously, I could simply create a new, back-dated weekly post and add the content of each of the daily posts to it.

But the theoretical question remains... Does the FlatPress code use the folder structure within the fp-content folder in any way that would stop someone from changing a post date or time by the appropriate moving and renaming of an individual post file.

User avatar
Arvid
FlatPress Coder
Posts: 234
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Change A Post Date

Post by Arvid » Sat Jun 19, 2021 10:49 am

NorfolkGreg wrote: ↑Mon Jun 14, 2021 11:27 pm Can I change the date or time of a post simply by placing the entry file in the appropriate year and month folder and giving it a name that reflects the new date and time?

Do I need to edit any other file to ensure the entries remain indexed properly?
This is an interesting question, I actually never tried this - feel free to do so (maybe in a test environment at first ;) )
You can easily rebuild the index via Admin Area -> Maintain -> Rebuild index.

All the best,
Arvid

NorfolkGreg
Posts: 26
Joined: Wed Dec 30, 2020 9:58 pm

Re: Change A Post Date

Post by NorfolkGreg » Tue Jun 29, 2021 8:19 pm

I did my test.

First, I added a new folder structure for the intended target year and month. then I copied an entry file to the new location and edited the file name to reflect the intended date/time stamp.

I'm not sure whether the new entry was displayed immediately or whether I also did a "Rebuild Index" to force it to display. (That's because I had two instances of FlatPress running and I may have done the Rebuild on the wrong instance.) But it was certainly no more difficult than that.

However, I then realised that both entries were displaying the original date!

A little more investigation showed that each entry file includes a footer that include a date specifier. e.g. |DATE|1361822049|

I guessed that this was the number of seconds after a certain date. With the help of https://www.epochconverter.com/ I quickly found that my guess of 1/1/1970 was indeed the magic number.

So now I have an entry that shows it was posted in February 2013 and appears as being part of the archives for that date too!

User avatar
Arvid
FlatPress Coder
Posts: 234
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Change A Post Date

Post by Arvid » Sat Jul 10, 2021 12:25 pm

Awesome, glad it worked :)

Indeed, most date and time values are stored in IT as UNIX timestamps (seconds since epoch, 1970-01-01 00:00:00 UTC).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest