Skip to:
Content
Pages
Categories
Search
Top
Bottom

I am desperate: I want to show last posts on forum index and not last posters


  • medousa
    Participant

    @medousa

    Hi all!
    I am sorry if this question has been answered in the past. I looked for everywhere, in bbpress and google and did not find anything similar or those I found were not understandable.
    On my forum index there are shown last posters (what members were the last that posted a topic in each forum) but instead, I want to show last topic titles.
    What do I have to do?
    Any help will be appreciated.

    Thank you!

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

  • Robin W
    Moderator

    @robin-w

    put this in your functions file

    function rw_custom_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_attr( $title ) . '</a>';
    		else
    			$anchor = esc_html__( 'No Topics', 'bbpress' );
    
    		return apply_filters( 'rw_get_forum_freshness_link', $anchor, $forum_id, $time_since, $link_url, $title, $active_id );
    	}
    	
    	add_filter('bbp_get_forum_freshness_link', 'rw_custom_freshness_link' );

    Functions files and child themes – explained !


    medousa
    Participant

    @medousa

    Hi and thanks for your reply but I have a parent theme and can not create a child theme.
    Can I paste this code into a parent theme and if yes, at what function file?
    There are plenty into the dashboard.There is bbpress-functions, there is theme functions, functionsbu.php. Can you pls specify? I would deeply appreciate this!


    Robin W
    Moderator

    @robin-w

    yes – functions.php in your parent theme will be the place, BUT keep a record of what you have changed, as you’ll lose this on any theme updates, and will need to add it back after upgrade !

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