Is this what you want? If a post date is February 10, 2010, you want to show February 10, 1903?
If so, use this to display the date:
date('F j, Y',strtotime('-107 years',strtotime($post->post_date)))
Thanks vtxyzzy, that’s exactly what I’m trying to do. Where should I put this code specifically? Does it go in the custom format box of dashboard or need to be entered somewhere else within the code on one of the pages?
Many thanks
Neil
You need to replace the call to the_date() in your theme templates with this:
echo date('F j, Y',strtotime('-107 years', strtotime($post->post_date)));
Most of the time, the templates (index.php, single.php, etc) will have code like this:
‘<?php the_date(); ?>`
Replace that with:
<?php echo date('F j, Y',strtotime('-107 years', strtotime($post->post_date))); ?>
`
Hmm both my index.php and single.php don’t contain the date references at all and that syntax isn’t showing in my theme template.
The only reference to date I can find is in my functions.php which has the following:
if (!function_exists(‘get_the_date’)) {
function get_the_date($format = ‘F jS, Y’) {
return get_the_time(__($format, THEME_NS));
Thanks again for your help on this.
Neil
I see you are using an Artisteer theme, and you found the correct place to make the change. However, it is a bit different than I thought.
Make a backup copy of functions.php first, because if you have an error in it, you will not be able to log in to your theme. You will have to use FTP to restore the copy.
Try changing this:
return get_the_time(__($format, THEME_NS));
to this:
global $post;
return date(__($format, THEME_NS), strtotime('-107 years', strtotime($post->post_date)));
Thanks for the tip – I followed your instructions as you said but still not working. It still shows the date as 2010 and all the posts still have the same identical date on them even though they were added on separate days – strange.
Thanks again for your help on this
Looks like you will need to change calls for get_the_time to get_my_time in your templates and rename the function in functions.php.
I’ve now renamed the function in functions.php
Regarding the template I’ve used Artisteer to generate my blog. Should I be looking in page.php or somewhere else for the get_the_time reference?
Thanks again for your help
I think the only other place is just a little further down in functions.php.