Skip to:
Content
Pages
Categories
Search
Top
Bottom

change post time to time ago


  • zoddshop63
    Participant

    @zoddshop63

    How can I change the date in the topic to use the time ago format
    The rest of the site is using the time ago format already.

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

  • Robin W
    Moderator

    @robin-w

    add_filter( 'bbp_get_reply_post_date', 'rew_show_time_since' , 10 , 6) ;
    add_filter( 'bbp_get_topic_post_date', 'rew_show_time_since' , 10 , 6) ;
    
    function rew_show_time_since ($result, $reply_id, $humanize, $gmt, $date, $time ){
    	$gmt_s  = ! empty( $gmt ) ? 'G' : 'U';
    	$date   = get_post_time( $gmt_s, $gmt, $reply_id );
    	$result = bbp_get_time_since( $date );
    return $result ;	
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets


    zoddshop63
    Participant

    @zoddshop63

    works
    thank you


    Robin W
    Moderator

    @robin-w

    🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar