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

"Filter: bricks/active_templates"

آرایه الگوهای فعال (سرصفحه، پاورقی، محتوا، پنجره بازشو) را که Bricks تعیین کرده است باید برای صفحه فعلی ارائه شود، فیلتر می‌کند.

پارامترها

  • $active_templates (array): Array of active template IDs, keyed by template type (e.g., header, footer, content, popup).
  • $post_id (int): The current post ID being rendered.
  • $content_type (string): The type of content being rendered (e.g., content, archive, search, error).

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

add_filter( 'bricks/active_templates', function( $active_templates, $post_id, $content_type ) {
    // Example: Use a specific header template (ID: 1234) for single posts
    if ( is_single() ) {
        $active_templates['header'] = 1234;
    }

    return $active_templates;
}, 10, 3 );