pbs_localize_frontend_scripts

എഴുതിയത്

ഇൻ

,

pbs_localize_frontend_scripts

ഫ്രണ്ട്-എൻഡിലെ pbsFrontendParams ഒബ്ജക്റ്റിലേക്ക് Javascript പ്രോപ്പർട്ടികൾ ചേർക്കുന്നു. ഉപയോക്താവ് ലോഗിൻ ചെയ്‌ത് എഡിറ്റുചെയ്യുമ്പോൾ പരിഗണിക്കാതെ തന്നെ pbsFrontendParams ഒബ്‌ജക്റ്റ് ഫ്രണ്ട്-എൻഡിൽ ലഭ്യമാണ്.

പാരാമീറ്ററുകൾ

$params

അറേ. വിൻഡോ-ലെവൽ Javascript വേരിയബിളായ pbsFrontendParams-ൽ ലഭ്യമാകുന്ന കീകൾ, മൂല്യങ്ങൾ എന്നിവയുടെ ഒരു അറേ

ഉദാഹരണം

ഫ്രണ്ട്-എൻഡിൽ ഒരു വേരിയബിൾ ലഭ്യമാക്കുക

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