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

"Filter: bricks/query/force_is_looping"

Bricks\Query::is_looping() را مجبور به بازگشت true می‌کند. این در زمینه‌های AJAX (مانند پنجره‌های بازشو) مفید است، جایی که باید حضور در یک حلقه Query را شبیه‌سازی کنید تا داده‌های پویا را به درستی ارائه کنید که به بافت حلقه بستگی دارد.

پارامترها

  • $force (bool): Whether to force the is_looping state. Default is false.
  • $query_id (string): The ID of the query being checked.
  • $element_id (string): The ID of the element being checked.

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

add_filter( 'bricks/query/force_is_looping', function( $force, $query_id, $element_id ) {
    // Example: Force looping for a specific element ID
    if ( $element_id === 'my_element_id' ) {
        return true;
    }

    return $force;
}, 10, 3 );