Bp_Search_Documents::generate_html( $template_type = '' )

Description

Source

File: bp-search/classes/class-bp-search-documents.php

		protected function generate_html( $template_type = '' ) {
			$document_ids = array();
			foreach ( $this->search_results['items'] as $item_id => $item_html ) {
				$document_ids[] = $item_id;
			}

			// now we have all the posts
			// lets do a documents loop
			$args = array(
				'include'      => implode( ',', $document_ids ),
				'per_page'     => count( $document_ids ),
				'search_terms' => false,
			);

			do_action( 'bp_before_search_documents_html' );

			if ( bp_has_document( $args ) ) {

				while ( bp_document() ) :
					bp_the_document();

					$result = array(
						'id'    => bp_get_document_id(),
						'type'  => $this->type,
						'title' => bp_get_document_title(),
						'html'  => bp_search_buffer_template_part( 'loop/document', $template_type, false ),
					);

					$this->search_results['items'][ bp_get_document_id() ] = $result;
				endwhile;
			}

			do_action( 'bp_after_search_documents_html' );
		}

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.