Child theme
توجه
فایلهای core تم Bricks را مستقیم ویرایش نکنید — با بهروزرسانی تم تغییرات از بین میرود.
بهجای آن از child theme Bricks برای تغییر و override فایلها استفاده کنید. child theme را از حساب Bricks دانلود کنید.
فایل ZIP (bricks-child.zip) را مثل هر تم وردپرس آپلود کنید. Appearance → Themes → Bricks Child Theme را فعال کنید. استایل خود را در style.css اضافه کنید.
بارگذاری Script (JS) و Style (CSS)
برای بارگذاری فقط در فرانتاند و canvas — نه پنل سازنده (CSS سفارشی ممکن است سازنده را تحت تأثیر قرار دهد) — با bricks_is_builder_main() بررسی کنید:
add_action( 'wp_enqueue_scripts', function() {
// Code & check below enqueues your files on the canvas & frontend, not the builder panel. Otherwise custom CSS might affect builder)
if ( ! bricks_is_builder_main() ) {
wp_enqueue_style( 'bricks-child', get_stylesheet_uri(), ['bricks-frontend'], filemtime( get_stylesheet_directory() . '/style.css' ) );
}
} );
درباره child theme: WordPress Codex — Child Themes
functions.php child theme برخلاف style.css، functions.php parent را override نمیکند؛ علاوه بر آن و قبل از parent بارگذاری میشود.