pbs_localize_frontend_scripts

Adds Javascript properties to the pbsFrontendParams object in the front-end. The pbsFrontendParams object is available in the front-end regardless when the user is logged in and editing.

Parameters

$params

Array. An array of keys and values which will become available in the window-level Javascript variable pbsFrontendParams

Example

Make a variable accessible in the front-end

add_filter( 'pbs_localize_frontend_scripts, 'add_my_property' );

function add_my_property( $params ) {
	
	// This will be available in Javascript under pbsFrontendParams.myProperty
	$params['myProperty'] = 'My Property';
	return $params;
}

Still need help? Contact Us Contact Us