Astra_Ext_Adv_Search_Shortcodes::search_markup( array $atts )

Search Markup


Description


Parameters

$atts

(array) (Required) Shortcode parameters.


Return

(mixed)


Source

File: addons/advanced-search/classes/class-astra-ext-adv-search-shortcodes.php

		public function search_markup( $atts ) {

			wp_enqueue_style( 'advanced-search-shortcode' );

			$atts = shortcode_atts(
				array(
					'style'     => 'slide',
					'direction' => 'left',
				),
				$atts
			);

			if ( 'inline' === $atts['style'] ) {
				$markup = Astra_Ext_Adv_Search_Markup::get_instance()->get_search_form( 'search-box' );
			} elseif ( 'full-screen' === $atts['style'] ) {
				$markup = '<div class="ast-search-icon"><a class="full-screen astra-search-icon" aria-label="Search icon link" href="#" ></a></div>';
				add_action(
					'wp_footer',
					function() {
						echo Astra_Ext_Adv_Search_Markup::get_instance()->get_search_form( 'full-screen' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
					}
				);
			} elseif ( 'cover' === $atts['style'] ) {
				$markup  = '<div class="ast-search-icon"><a class="header-cover astra-search-icon" aria-label="Search icon link" href="#"></a></div>';
				$markup .= Astra_Ext_Adv_Search_Markup::get_instance()->get_search_form( 'header-cover' );
			} else {
				$markup = astra_get_search();
			}

			$classes = array( 'astra-search-shortcode', 'search-custom-menu-item' );

			if ( ! empty( $atts['style'] ) ) {
				$classes[] = $atts['style'];
			}

			if ( ! empty( $atts['direction'] ) ) {
				$classes[] = $atts['direction'];
			}

			$classes = implode( ' ', $classes );
			ob_start();
			?>
			<div class="<?php echo esc_attr( $classes ); ?>">
				<?php echo $markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
			</div>
			<?php
			return ob_get_clean();
		}

Changelog

Changelog
Version Description
1.4.8 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.