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

"Filter: bricks/filter_element/count_source_custom_field"

داده‌های شمارش را برای یک منبع فیلتر خاص فیلتر می‌کند. قسمت {$filter_source} نام قلاب باید با نام منبع واقعی جایگزین شود (به عنوان مثال، taxonomy، custom_field، wcField).

پارامترها

  • $count_source (array): Associative array where keys are filter values and values are their respective counts.
  • $element (object): The filter element instance.

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

// Filter counts for a custom field filter source
add_filter( 'bricks/filter_element/count_source_custom_field', function( $count_source, $element ) {
    // Example: Override the count for a specific value
    if ( isset( $count_source['featured'] ) ) {
        $count_source['featured'] = 999;
    }

    return $count_source;
}, 10, 2 );