pbs_localize_frontend_scripts

This article was written for Page Builder Sandwich 5 or earlier. Page Builder Sandwich 6 is a new block builder, so some steps and screens here may differ. Getting started with version 6

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;
}