Code snippet for moving up the "Search Alert" button on the right panel

I purchased the Search Alert plugin and right now the only place it’s visible is at the bottom of the filters so it’s not very visible to users. Is it possible to move it up on the screen to be at the top of the filters?

1 Like

Please try this PHP snippet but please note that it can require further customization

add_filter( 'hivepress/v1/templates/listings_view_page', 'custom_move_search_alert', 1000, 2 );
add_filter( 'hivepress/v1/templates/requests_view_page', 'custom_move_search_alert', 1000, 2 );

function custom_move_search_alert($template_args, $template){
	return hivepress()->helper->merge_trees(
			$template_args,
			[
				'blocks' => [
					'page_sidebar' => [
						'blocks' =>[
							'search_alert_toggle' => [
								'type'   => 'search_alert_toggle',
								'_order' => 1,
							],
						], 
					],
					
					$template::get_meta( 'model' ) . '_filter_form' => [
						'footer' => [
							'search_alert_toggle' => [
								'type'   => 'content',
							],
						],
					],
				],
			]
		);
}

Hello Yevhen, I tried this and it removed the search functionality from the template all together. Any other suggestions?

Please try this PHP snippet instead

add_filter( 'hivepress/v1/templates/listings_view_page', 'custom_move_search_alert', 1000, 2 );
add_filter( 'hivepress/v1/templates/requests_view_page', 'custom_move_search_alert', 1000, 2 );

function custom_move_search_alert($template_args, $template){
	return hivepress()->helper->merge_trees(
			$template_args,
			[
				'blocks' => [				
					$template::get_meta( 'model' ) . '_filter_form' => [
						'footer' => [
							'search_alert_toggle' => [
								'type'   => 'content',
							],
						],
						
						'header' => [
							'search_alert_toggle' => [
								'type'   => 'search_alert_toggle',
								'_order' => 1,
							],
						],
					],
				],
			]
		);
}

this works, thank you!

1 Like