Bp_Search_bbPress::generate_html( $template_type = '' )
Description
Source
File: bp-search/classes/class-bp-search-bbpress.php
protected function generate_html( $template_type='' ){ $post_ids = array(); foreach( $this->search_results['items'] as $item_id=>$item_html ){ $post_ids[] = $item_id; } remove_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', 4 ); //now we have all the posts //lets do a wp_query and generate html for all posts $qry = new WP_Query( [ 'post_type' => [ 'forum', 'topic', 'reply' ], 'post__in' => $post_ids, 'post_status' => [ 'publish', 'private', 'hidden' ], 'no_found_rows' => true, 'nopaging' => true ] ); add_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', 4 ); if( $qry->have_posts() ){ while( $qry->have_posts() ){ $qry->the_post(); /** * The following will try to load loop/forum.php, loop/topic.php loop/reply.php(if reply is included). * */ $result_item = array( 'id' => get_the_ID(), 'type' => $this->type, 'title' => get_the_title(), 'html' => bp_search_buffer_template_part( 'loop/' . $this->type, $template_type, false ), ); $this->search_results['items'][get_the_ID()] = $result_item; } } wp_reset_postdata(); }
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.