bbPress latest topics by activity
-
I finally started playing with bbPress. There are lot to learn because I want to display topics totally differently what is the default output.
First I want to display latest topics by latest activity like usual. I’ve created archive-topic.php in my theme so I can decide output.
After that I can filter topic post type so that topics are ordered by latest activity.
add_action( 'pre_get_posts', 'my_filter_topic' );
function my_filter_topic( $query ) {
if( $query->is_main_query() && is_post_type_archive( 'topic' ) ) {
$query->set( 'meta_key', '_bbp_last_active_id' );
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'order', 'DESC' );}
}
But this doesn’t display sticky posts first. They are more like last. Does someone have an idea how I get sticky posts to show first?
- You must be logged in to reply to this topic.