bbPress

Simple, Fast, Elegant

bbPress support forums » Themes

How do you change the Freshness of post date format?

(8 posts)
  • Started 1 year ago by Inquirer
  • Latest reply from SamBauers
  • This topic is not resolved
  1. Inquirer
    Member

    What is the code to change the Freshness of post format to the Date - Hours - Minutes ?

    Posted 1 year ago #
  2. Ziyphr
    Member

    http://uk3.php.net/manual/en/function.date.php

    Don't have access to the code right now so not sure where in bbPress you need to edit.

    Posted 1 year ago #
  3. Remember that the date will be relative to worldwide visitors unless you list the timezone (which will be meaningless to people far outside the timezone).

    What I do on some code is list the freshness in plain english but make the title of the element the original time.

    ie.

    <span class=timetitle title="<? echo date("r",strtotime($topic->topic_time)); ?>"><?php topic_time(); ?></span>

    Then when you mouse over the "3 days ago" it will show you the original time (in mysql format which can be changed). Then use CSS to make a light underline so the user knows it has some kind of function.

    I've implemented this idea over here to show you how it works:
    http://bbpress.nfshost.com/forums/

    Posted 1 year ago #
  4. Inquirer
    Member

    Hi ck:

    [Remember that the date will be relative to worldwide visitors unless you list the timezone (which will be meaningless to people far outside the timezone).]

    The time isn't of concern. I would like it to initialize to my time zone of U.S Central.

    Actually, I prefer to display the date format you have implemented in the the mouseover without implementing a mouseover rather than the current number of days format.

    What would be the code and which file is it located?

    Thank you for your response to my inquiry.

    Posted 1 year ago #
  5. Inquirer
    Member

    The following code is in the front-page.php file

    <th><?php _e('Freshness'); ?></th>

    What file contains the code to change the Freshness of post format from the default of Days to the Date - Hours - Minutes ?

    Posted 1 year ago #
  6. That php _e('Freshness') just echoes the table header. A couple lines beneath that you will find the call to the function that provides the time elapsed (i.e. the Freshness):

    <?php topic_time(); ?>

    Instead of that topic_time, you could just insert the code like _ck_ has shown, modified a little bit, so instead of this in your template files:
    <?php topic_time(); ?>

    use this:
    <? echo date("date format here", strtotime($topic->topic_time)); ?>

    where date format here is some combination of characters from here: http://www.php.net/date

    For example:
    <?php echo date("D M j Y G:i:s", strtotime($topic->topic_time)); ?>
    prints like Sun Aug 19 2007 1:53:54 right now, but it would be based on the topic time of the post in your case.

    You would need to look at these files, at least, in your template directory:
    ./favorites.php
    ./forum.php
    ./front-page.php
    ./tag-single.php
    ./view.php

    It's safe to modify your own template files. You're not modifying the core bbPress files. But maybe this would be better as a plugin, I'm not sure.

    Good luck.

    Posted 1 year ago #
  7. Inquirer
    Member

    Hi chrishajer:

    I moved the files you listed to my-templates folder then edited using the code

    <?php echo date("D M j Y G:i:s", strtotime($topic->topic_time)); ?>

    I FTPed the files to my server.

    The new date time format appears to be working.

    Thanks.

    Posted 1 year ago #
  8. I believe you can do this...

    <?php topic_time('D M j Y G:i:s'); ?>

    But I've never tried it.

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.