Dunstan’s Time Since
-
I’d post on the plugin support page, but it says that it is no longer supported, so I thought I’d ask here.
So first, I was using the php code as provided by the default theme:
<$ php $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; ?>
And that worked fine except for on entries that are posted on the day of. I made a test entry today and it said something like ‘This entry was posted -1 year, 256 days ago,’ which is a roundabout way of saying today, I guess.
So, I went to the plugin site and copy and pasted the code from there:
`
<?php if (function_exists(‘time_since’)) {
echo time_since(abs(strtotime($post->post_date_gmt . “ GMT”)), time()) . “ ago”;
} else {
the_time(‘F jS, Y’);
} ?>’And that gives me this error:
Parse error: parse error, unexpected T_STRING in /index.php on line 12
which I know has something to do with not putting in backslashes where there’s a single quote or something of that sort, but I can’t see the error (probably due to inexperience).I need help on one of two things: make the first code work better. I’d like a post that I post today to say “this was posted x hours, x minutes ago.” It works now, just not the way I’d like it to.
Or. Find the error in the second code so that I can see if that one works any better.
Please and thank you! I’d really appreciate any help on this.
- The topic ‘Dunstan’s Time Since’ is closed to new replies.