Skip to:
Content
Pages
Categories
Search
Top
Bottom

Freshness Date Format


  • lajd
    Participant

    @lajd

    Hi,

    How should I modify the format of the freshness date.
    I want to change it to date and time.
    I already google it,also search in this forum but can’t find clear solution.

    see attached image:
    screenshot

    Thanks

Viewing 6 replies - 26 through 31 (of 31 total)

  • Robin W
    Moderator

    @robin-w

    ok can you say which lines should do what?


    Robin W
    Moderator

    @robin-w

    ok,

    can you say which lines in loop-single-topic you need which in?


    Caroline Hehemann
    Participant

    @carolinehehe

    I need the filtered freshness date after the topic title and the ‘since’ freshness link after the reply count.

    In my loop-single-topic.php it should go in line 105, but I already modified the file.
    Does this actually matter?

    Could you tell how I could deactivate the filter for a certain topic_freshness_link?


    Robin W
    Moderator

    @robin-w

    ok so leave in the code that you have – that will make the default into date

    then add this

    function rew_forum_freshness_link( $forum_id = 0) {
    	echo rew_get_forum_freshness_link( $forum_id );
    }
    
    function rew_get_forum_freshness_link( $forum_id = 0 ) {
    		$forum_id  = bbp_get_forum_id( $forum_id );
    		$active_id = bbp_get_forum_last_active_id( $forum_id );
    		$link_url  = $title = '';
    
    		if ( empty( $active_id ) )
    			$active_id = bbp_get_forum_last_reply_id( $forum_id );
    
    		if ( empty( $active_id ) )
    			$active_id = bbp_get_forum_last_topic_id( $forum_id );
    
    		if ( bbp_is_topic( $active_id ) ) {
    			$link_url = bbp_get_forum_last_topic_permalink( $forum_id );
    			$title    = bbp_get_forum_last_topic_title( $forum_id );
    		} elseif ( bbp_is_reply( $active_id ) ) {
    			$link_url = bbp_get_forum_last_reply_url( $forum_id );
    			$title    = bbp_get_forum_last_reply_title( $forum_id );
    		}
    
    		$time_since = bbp_get_forum_last_active_time( $forum_id );
    
    		if ( !empty( $time_since ) && !empty( $link_url ) )
    			$anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>';
    		else
    			$anchor = esc_html__( 'No Topics', 'bbpress' );
    
    		return apply_filters( 'rew_get_forum_freshness_link', $anchor, $forum_id, $time_since, $link_url, $title, $active_id );
    	}

    and where you want to show a ‘since’ freshness link change

    bbp_forum_freshness_link() to
    rew_forum_freshness_link()

    You should put any amended templates into your child theme

    come back if you don’t know how to do that


    Caroline Hehemann
    Participant

    @carolinehehe

    It works!
    Thanks a lot Robin W!


    Robin W
    Moderator

    @robin-w

    Great – glad you are fixed

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