Skip to:
Content
Pages
Categories
Search
Top
Bottom

Post Freshness

  • Avatar of James
    James
    Participant

    @janismo

    hi,

    is it possible to display date of post as freshness e.g. “23 hours, 19 minutes ago” (like at forum topics or activities in BP)?

    thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    You’ll need to modify the post metadata display in your child theme.

    Take a look at the function: bp_core_time_since()

    It’s defined in bp-core.php

    It uses a technique described in http://1976design.com

    Avatar of James
    James
    Participant

    @janismo

    @Roger Coathup
    hi,

    found information below, but still can not achieve any result. Maybe you could write necessary php code for me?
    thank you!!

    bp_core_time_since( $older_date, $newer_date = false ) X-Ref
    bp_core_time_since()

    Based on function created by Dunstan Orchard – http://1976design.com

    This function will return an English representation of the time elapsed
    since a given date.
    eg: 2 hours and 50 minutes
    eg: 4 days
    eg: 4 weeks and 6 days

    param: $older_date int Unix timestamp of date you want to calculate the time since for
    param: $newer_date int Unix timestamp of date to compare older date to. Default false (current time).
    return: str The time since.

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @janismo – if you want a developer to help write the code for your site, you can advertise the opportunity on the Jobs Board: http://buddypress.org/community/groups/bp-jobs-board/

    You can also search the BuddyPress plugin files for examples of how to call bp_core_time_since()

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.