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

"Filter: bricks/popup/attributes"

ویژگی‌های HTML ظرف بازشو را فیلتر می‌کند. این به شما امکان می‌دهد کلاس های سفارشی، ویژگی‌های داده یا سایر ویژگی ها را به عنصر بازشو اضافه کنید.

پارامترها

  • $attributes (array): Array of HTML attributes (e.g., class, data-popup-id).
  • $popup_id (int): The ID of the popup template.

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

add_filter( 'bricks/popup/attributes', function( $attributes, $popup_id ) {
    // Example: Add a custom class to a specific popup
    if ( $popup_id === 1234 ) {
        $attributes['class'][] = 'my-custom-popup-class';
        $attributes['data-custom-attr'] = 'value';
    }

    return $attributes;
}, 10, 2 );