Skip to:
Content
Pages
Categories
Search
Top
Bottom

Missing Date on Started by

Viewing 7 replies - 1 through 7 (of 7 total)
  • @robin-w

    Moderator
    add_action( 'bbp_theme_after_topic_started_by' , 'rew_add_date' ); 
    
    function rew_add_date () {
    	echo ' on ' ;
    	bbp_topic_post_date() ;
    }

    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

    @deepblue5

    Participant

    Great Robin it works ! thanks 🙂

    i will need to manually change html on the topics listings (forum) template, which file should i edit then ? (i want to rename “started by”, change the way freshness avatar is showing with html (not possible with css) etc

    and therefore is there a way to manually add this date directly on that file ?

    Thanks 🙂

    @robin-w

    Moderator

    loop-single-topic.php

    @deepblue5

    Participant

    Hi Robin

    I have your function that you gave me above :

    // FORUM ADD DATE OF TOPIC CREATION
    add_action( 'bbp_theme_after_topic_started_by' , 'rew_add_date' ); 
    
    function rew_add_date () {
    	echo ' on ' ;
    	bbp_topic_post_date() ;
    }

    I would like to show only the date and remove the time ie :

    August 4 2012 instead of August 4 2012 at 2:37 pm

    how can i get that ?

    thanks !

    @robin-w

    Moderator

    untested, but this should work

    add_filter( 'bbp_get_topic_post_date', 'rew_date_only' , 20, 6) ;
    
    function rew_date_only ($result, $topic_id, $humanize, $gmt, $date, $time ){
    		$topic_id = bbp_get_topic_id( $topic_id );
    
    		// 4 days, 4 hours ago
    		if ( ! empty( $humanize ) ) {
    			$gmt_s  = ! empty( $gmt ) ? 'G' : 'U';
    			$date   = get_post_time( $gmt_s, $gmt, $topic_id );
    			$time   = false; // For filter below
    			$result = bbp_get_time_since( $date );
    
    		// August 4, 2012 at 2:37 pm
    		} else {
    			$date   = get_post_time( get_option( 'date_format' ), $gmt, $topic_id, true );
    			$result = $date;
    		}
    
    		// Filter & return
    		return apply_filters( 'rew_date_only', $result, $topic_id, $humanize, $gmt, $date, $time );
    	}
    }

    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

    @deepblue5

    Participant

    Thanks

    it works like a charm 🙂

    @robin-w

    Moderator

    🙂

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