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

Generare Html for albums search

Description

Parameters

$template_type

(Optional) Template type.

Default value: ''

Source

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

			do_action( 'bp_before_search_albums_html' );

			if ( bp_has_albums( $args ) ) {

				while ( bp_album() ) :
					bp_the_album();

					$result = array(
						'id'    => bp_get_album_id(),
						'type'  => $this->type,
						'title' => bp_get_album_title(),
						'html'  => bp_search_buffer_template_part( 'loop/albums', $template_type, false ),
					);

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

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