doAction( "init_area", area );
doAction( "init_area_{key}", area );
Fired right after an area was fully initialized and is ready to be displayed.
The dynamic part of the filter name is the sanitized Area key. See DiviAreaItem.theKey()
for details.
Params
area
- The Area which was initialized.
Examples
// Output a console comment upon initializing an Area.
DiviArea.addAction( 'init_area', function( area ) {
var areaKey = area.getKey();
console.log( 'Area is ready:', key );
});
// Instantly display the Divi Area with the ID "safety-notice".
// Notice, how the ID "safety-notice" changes to "safety_notice" in the hook name!
DiviArea.addAction( 'init_area_safety_notice', function( area ) {
DiviArea.show( 'safety-notice' );
});
Notes
At this stage, the Area is not visible. This is the earliest point when DiviArea.show()
can display the area.
Though the Area is hidden, it’s still in the DOM and can be accessed by other scripts for a short time. See details on the area_preparation_time
filter for more information.