Info
- 23 posts
- 10 voices
- Started 5 years ago by maker
- Latest reply from MatasLTU
- This topic is not resolved
Show exact date of post? (not freshness)
-
- Posted 5 years ago #
I like the 'freshness' and all but how do I show the exact date of a post? Preferably at the bottom of the actual post (where currently a repeat of the freshness is)
-
- Posted 5 years ago #
I suspect that this will work. Replace
get_post_time()or whatever it is withglobal $post; echo $post->post_time;(Remember to have the
<?php...?>tags around it!) If you want different formatting on that, I think that$post->post_timeis a bit too much detail so you could instead haveglobal $post; $lalaposttime = date( 'D M Y', strtotime( $post->post_id ) ); echo $lalaposttime;You can change the way the date will appear by changing the first parameter (currently it's 'D M Y') of the
date()function. A list of how you can format dates is here. -
- Posted 5 years ago #
Thanks fel64,
So I paste that in post.php?
around this stuff?
<?php printf( __('Posted %s ago'), bb_get_post_time() ); ?>
-
- Posted 5 years ago #
Paste in
<?php global $post; $lalaposttime = date( 'D M Y', strtotime( $post->post_id ) ); echo $lalaposttime; ?>anywhere you like outside other
<?php ... ?>tags. So you could put it next to the code snippet you quoted. If you use Notepad 2 or something it makes it a lot easier by colour-coding these things.The fact that it's spread out over several lines doesn't make a difference when it's inside the
<?php ... ?>tags. :) -
- Posted 5 years ago #
Hi Fel64,
Thanks for your help.
I get "THU JAN 1970" now. (I'd prefer the exact date)
Like here: http://www.mpm.org.au/topic/7?replies=1
-
- Posted 5 years ago #
Replace
D M Ywith a date-formatted string of your choice. It's quite an interesting but simple system. Each letter stands for a different type of date or time. SoDis replaced by first three letters of the weekdate,Mby first three of the month etc.This reference will tell you what letters to use to see what date outputs you get. Roll your own date format. :)
-
- Posted 5 years ago #
I have a problem with this displaying the incorrect date. Do I need to set anything to get the correct date?
-
- Posted 5 years ago #
What does it show? Something completely crazy or something slightly wrong?
You can set your timezone in
config.php, just change$bb->gmt_offsetto whatever you want. -
- Posted 5 years ago #
It shows "Thu, 01 Jan 1970" for every post.
-
- Posted 5 years ago #
I see. Sorry, I thought that was just an example for the format.
How's this instead?<?php global $post; $lalaposttime = date( 'D M Y', strtotime( $post->post_time ) ); echo $lalaposttime; ?> -
- Posted 5 years ago #
Sorry, but no change.
-
- Posted 5 years ago #
Okay, I promise in future I'll be all mature and responsible and test these things first. Sorry for the inconvenience. This works on my forum now; just copy and paste this into a new plugin file. Then put
<?php aposttime(); ?>for default time output, or<?php aposttime( 'DATE FORMAT' ); ?>for your own time formatting.<?php /* Plugin Name: Accurate Post Time Plugin URI: Description: Outputs an accurate post time in, optionally, your choice of formatting. Use <?php aposttime( 'DATE FORMAT' ); ?> in your template, <a href="http://uk3.php.net/date">date formatted according to PHP standards.</a> Author: fel64 Version: Phi Author URI: http://www.loinhead.net/ */ function aposttime ( $dtformat = "jS F 'y" ) { global $bb_post; $aposttime = date( $dtformat, strtotime( $bb_post->post_time ) ); echo $aposttime; } ?> -
- Posted 5 years ago #
Thank you fel64!
I owe you a wealth of sundays!
-
- Posted 4 years ago #
So many unarchived plugins that are so nice...
-
- Posted 4 years ago #
See my post in this thread for a similar way to handle this by allowing both freshness and exact time in a title attribute:http://bbpress.org/forums/topic/how-do-you-change-the-freshness-of-post-date-format
-
- Posted 4 years ago #
I can't seem to get this to use the time offset in config.php. It displays the post time in GMT, all the time. I have this in my config.php.
$bb->gmt_offset = -5;
Changing the value has no effect on the displayed time.
-
- Posted 4 years ago #
I tried changing the date format using fel64's wonderful plugin. It works great except the time is inaccurate. I have the timezone displayed. It shows the eastern time zone apparently. The problem is, the time displayed is obviously off by a lot. It says I posted something at 3:22 PM EST when in reality I posted it at 9:30 AM central time, which is 10:30 AM eastern time. Does anyone have an explanation for this? To see what I mean, go to http://tapestry.endless-sonata.net . Hover over the freshness to see the exact time.
Edit: The timezone is supposed to be GMT, but apparently it's displayed as EST. Strange. Is there a way to display the time zone selected by the user or hardcoded on config.php?
-
- Posted 3 years ago #
Hi fel64, how to adapt your plugin for integrate the ck's plugin "forum last poster": http://bbpress.org/plugins/topic/123 and show the exact date with the two plugins?
thanks
-
- Posted 3 years ago #
Hack her plugin to use a custom time-displaying function instead of the bbPress ones. I've set up a ticket asking for it to be simple to do what you want but I don't believe it's that easy right now.
-
- Posted 2 years ago #
I used fel's plugin and I'm getting December 31, 1969 for every post. How can I fix this?
-
- Posted 1 year ago #
Thanks @fel64! Even a few years later it's still fresh and delicious--works like a dream.
-
- Posted 1 year ago #
I use Accurate Post Time plugin, to changing the date format. It's so easy.
-
- Posted 1 year ago #
Sorry for my very poor english
I can't believe that in bbpress forum there is no such a fundamental thing as post and topic date! I thing 80% of forum users need exact post date, not its freshness.
I spend a lot of time on this issue and finally fixed it!
All you need is to use both "Accurate Post Time" AND "User Timezones" plugins. First is for showing date and second is for setting it correctly.
It works fine for me!
-
You must log in to post.