PHP and last updated Time
-
Hello. Normally when I create a non WordPress website, I add
`<?php date_default_timezone_set(“EST”); echo date (“Y-m-j h:i:s A (T)”, getlastmod()); ?>’To the bottom of the page to show when the page was last updated.
But, for some reason, when I use it in single, archive, or index on any theme in WordPress, it shows the same date for all posts. I *kinda* can see why it would do that on the archive and index – it is showing the last time the index.php and archive.php was updated – not the actual post. But I am also trying to figure out if it is doing the same for single – displaying the last time single.php was modified and not the actual post itself.
I am using this on https://www.aleeya.net and have tried multiple themes, it does the same in each. I was placing it just under
‘Posted on <span class=”bold”><?php the_time(‘l, jS F Y’); ?></span> by <span class=”bold”><?php the_author(); ?></span>’On Single.php
I am trying to move the code and see if that changes it.
I have been searching for a plugin that would remedy this or some other way I can post it.
Does anyone have any ideas?
- The topic ‘PHP and last updated Time’ is closed to new replies.