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

"Filter: bricks/get_templates"

لیست الگوهای بازگردانده شده با روش Templates::get_templates() را فیلتر می‌کند. این به شما امکان می‌دهد آرایه الگوها را قبل از بازگرداندن آن به سازنده یا سایر بخش های برنامه تغییر دهید.

پارامترها

  • $templates (array): Array of template data.
  • $custom_args (array): The arguments used to query the templates.

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

add_filter( 'bricks/get_templates', function( $templates, $custom_args ) {
    // Example: Add a custom property to all templates
    foreach ( $templates as $key => $template ) {
        $templates[ $key ]['my_custom_property'] = 'value';
    }

    return $templates;
}, 10, 2 );