Use this code to add function to bulk upload custom font in Bricks Builder. Download google font font from https://gwfh.mranftl.com/fonts
1. enqueue_media_uploader
This function enqueues the WordPress media uploader script, but only for the bricks_fonts custom post type.
function enqueue_media_uploader() {
global $post_type;
if ('bricks_fonts' === $post_type) {
wp_enqueue_media();
}
}
add_action('admin_enqueue_scripts', 'enqueue_media_uploader');
2. Add_inline_media_uploader_script
This function adds inline JavaScript to handle the media uploader interface and manage the selection and processing of uploaded fonts.
3. allow_custom_font_mime_types (Optional)
This function allows custom MIME types for font file uploads.
function allow_custom_font_mime_types($mime_types) {
$mime_types['woff2'] = 'application/font-woff2';
$mime_types['woff'] = 'application/font-woff';
$mime_types['ttf'] = 'application/x-font-ttf';
return $mime_types;
}
add_filter('upload_mimes', 'allow_custom_font_mime_types');4. add_bricks_fonts_metabox
This function adds a meta box to the bricks_fonts post type for uploading fonts.
function add_bricks_fonts_metabox() {
add_meta_box(
'bricks_fonts_metabox',
'Upload Multiple Fonts',
'bricks_fonts_metabox_html',
'bricks_fonts',
'normal',
'high'
);
}
add_action('add_meta_boxes', 'add_bricks_fonts_metabox');
5. bricks_fonts_metabox_html
This function outputs the HTML content for the bricks_fonts meta box.

