پرش به محتویات

"Filter: bricks/get_remote_templates_data"

داده‌های بازیابی شده از یک منبع الگوی راه دور (به عنوان مثال، الگوهای انجمن Bricks یا یک کتابخانه از راه دور سفارشی) را فیلتر می‌کند. این به شما امکان می‌دهد تا الگوها را قبل از نمایش در مدیر قالب، تغییر دهید، اضافه یا حذف کنید.

پارامترها

  • $remote_templates (array): The decoded JSON response from the remote source, containing template data.

نمونه استفاده

add_filter( 'bricks/get_remote_templates_data', function( $remote_templates ) {
    // Example: Remove templates with a specific tag
    if ( ! empty( $remote_templates['templates'] ) ) {
        foreach ( $remote_templates['templates'] as $key => $template ) {
            if ( isset( $template['tags'] ) && in_array( 'deprecated', $template['tags'] ) ) {
                unset( $remote_templates['templates'][ $key ] );
            }
        }
    }

    return $remote_templates;
} );