"Filter: bricks/api/get_templates_data"
دادههای بازگردانده شده توسط نقطه پایانی Bricks REST API /get-templates-data/ را فیلتر میکند. این نقطه پایانی برای بازیابی الگوها، نویسندگان، بستهها، برچسبها و سایر داراییها برای کتابخانه الگو استفاده میشود.
پارامترها
$templates_data(array): Array containing:templates(array): List of template data.authors(array): List of template authors.bundles(array): List of template bundles.tags(array): List of template tags.globalVariables(array): Global variables.colorPalette(array): Color palettes.timestamp(int): Current timestamp.date(string): Formatted date.get(array): URL parameters from the request.
نمونه استفاده
add_filter( 'bricks/api/get_templates_data', function( $templates_data ) {
// Example: Remove a specific template bundle by name
if ( ! empty( $templates_data['bundles'] ) ) {
foreach ( $templates_data['bundles'] as $key => $bundle ) {
if ( $bundle === 'Deprecated Bundle' ) {
unset( $templates_data['bundles'][ $key ] );
}
}
}
return $templates_data;
} );