Freshness Date to Post Date
-
Hi,
I’ve been trying to find a solution to this but haven’t had any luck.Is there a way to change the Freshness date to the date the post was created instead of date of last activity?
I have created historical topics and want to display the post created date.
Any help is appreciated!
-
not fully tested, but try this in your functions file
//this function changes the bbp freshness data (time since) into a last post date for forums function rew_change_freshness_forum ($active_time ) { global $bsp_style_settings_freshness ; $forum_id = 0 ; // Verify forum and get topic creation date $forum_id = bbp_get_forum_id( $forum_id ); //last_active is now the creation date $last_active = get_post_field( 'post_date', $forum_id); $last_active = bbp_convert_date( $last_active ) ; $date_format = (!empty ( $bsp_style_settings_freshness['bsp_date_format'] ) ? $bsp_style_settings_freshness['bsp_date_format'] : get_option( 'date_format' ) ); $time_format = (!empty ( $bsp_style_settings_freshness['bsp_time_format'] ) ? $bsp_style_settings_freshness['bsp_time_format'] : get_option( 'time_format' )); if ($date_format == '\c\u\s\t\o\m' ) $date_format = $bsp_style_settings_freshness['bsp_date_format_custom'] ; if ($time_format == '\c\u\s\t\o\m' ) $time_format = $bsp_style_settings_freshness['bsp_time_format_custom'] ; $date= date_i18n( "{$date_format}", $last_active ); $time=date_i18n( "{$time_format}", $last_active ); //check the order if (!empty ($bsp_style_settings_freshness['date_order'])) { $first = $time ; $second = $date ; } else { $first = $date ; $second = $time ; } $separator = (!empty ($bsp_style_settings_freshness['date_separator'] ) ? $bsp_style_settings_freshness['date_separator'] : ' at ' ) ; $active_time = $first.$separator.$second ; return apply_filters ('rew_change_freshness_forum' , $active_time) ; } add_filter ('bsp_change_freshness_forum' , 'rew_change_freshness_forum' ) ; function rew_change_freshness_topic ($active_time, $topic_id = 0) { global $bsp_style_settings_freshness ; $topic_id = bbp_get_topic_id( $topic_id ); $last_active = get_post_field( 'post_date', $topic_id); $last_active = bbp_convert_date( $last_active ) ; $date_format = (!empty ( $bsp_style_settings_freshness['bsp_date_format'] ) ? $bsp_style_settings_freshness['bsp_date_format'] : get_option( 'date_format' ) ); $time_format = (!empty ( $bsp_style_settings_freshness['bsp_time_format'] ) ? $bsp_style_settings_freshness['bsp_time_format'] : get_option( 'time_format' )); if ($date_format == '\c\u\s\t\o\m' ) $date_format = $bsp_style_settings_freshness['bsp_date_format_custom'] ; if ($time_format == '\c\u\s\t\o\m' ) $time_format = $bsp_style_settings_freshness['bsp_time_format_custom'] ; $date= date_i18n( "{$date_format}", $last_active ); $time=date_i18n( "{$time_format}", $last_active ); //check the order if (!empty ($bsp_style_settings_freshness['date_order'])) { $first = $time ; $second = $date ; } else { $first = $date ; $second = $time ; } $separator = (!empty ($bsp_style_settings_freshness['date_separator'] ) ? $bsp_style_settings_freshness['date_separator'] : ' at ' ) ; $active_time = $first.$separator.$second ; return apply_filters ('rew_change_freshness_topic' , $active_time) ; } add_filter ('bsp_change_freshness_topic' , 'rew_change_freshness_topic' ) ;Thanks Robin! Will try this
Added to child theme functions but no change π
do you have style pack activated ?
I have style pack plugin activate but not the Freshness section. Should it be activated?
yes please, I’m hooking to stuff in that section
Ah…so sorry my bad!! π
Robin!!! It works!!!
Yay!!
Thank you thank you!!
I have been searching and searching for days to find a fix..before I resorted to posting a a message in the forums!Thank you so very much!!
Great – glad you are fixed – a 5 star review would be great !!
The topic ‘Freshness Date to Post Date’ is closed to new replies.