bp_nouveau_search_enqueue_scripts()

Enqueue the search scripts

Description

Source

File: bp-templates/bp-nouveau/includes/search/functions.php

function bp_nouveau_search_enqueue_scripts() {

	$data = array(
		'nonce'                 => wp_create_nonce( 'bp_search_ajax' ),
		'action'                => 'bp_search_ajax',
		'debug'                 => true,//set it to false on production
		'ajaxurl'               => admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ),
		//'search_url'    => home_url( '/' ), Now we are using form[role='search'] selector
		'loading_msg'           => __( "Loading Suggestions", "buddyboss" ),
		'enable_ajax_search'    => bp_is_search_autotcomplete_enable(),
		'per_page'              => bp_search_get_form_option( 'bp_search_number_of_results', 5 ),
		'autocomplete_selector' => "form[role='search'], form.search-form, form.searchform, form#adminbarsearch, .bp-search-form>#search-form",
		'form_selector'         => '',
	);

	if ( isset( $_GET["s"] ) ) {
		$data["search_term"] = $_GET["s"];
	}

	wp_enqueue_script( 'jquery-ui-autocomplete' );
	wp_enqueue_script( 'bp-nouveau-search' );

	wp_localize_script( 'bp-nouveau-search', 'BP_SEARCH', apply_filters( 'bp_search_js_settings', $data ) );
}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Introduced.

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.