Bp_Search_Media::generate_html( string $template_type = '' )

Generare Html for media search

Description

Parameters

$template_type

(string) (Optional) Template type.

Default value: ''

Source

File: bp-search/classes/class-bp-search-media.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 media loop.
			$args = array(
				'include'      => implode( ',', $document_ids ),
				'per_page'     => count( $document_ids ),
				'search_terms' => false,
			);

			do_action( 'bp_before_search_photos_html' );

			if ( bp_has_media( $args ) ) {

				while ( bp_media() ) :
					bp_the_media();

					$result = array(
						'id'    => bp_get_media_id(),
						'type'  => $this->type,
						'title' => bp_get_media_title(),
						'html'  => bp_search_buffer_template_part( 'loop/photos', $template_type, false ),
					);

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

			do_action( 'bp_after_search_photos_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.