Wordpress, WP Bakery Local Custom fonts global change

Viewed 25

The company I work with wants to switch from google fonts to locally hosted fonts to avoid any gdpr issues. The website is built with wp bakery. the major problem is that WP Bakery does not have the option to set global fonts and what we want to do is change to the custom fonts without having to manually go through every page and post and set it up there since we have a lot of pages. Perhaps, there is a function that replaces the currently used fonts to the custom one. Otherwise, maybe there is a function that reset all wp bakery elements to the default font and I would just change the default font to the custom one.

1 Answers

Knowing your specific build (theme as well) would help if you can provide that in your question.

However, here are a few resources that may help:

Add this to the functions.php of your child theme

<?php
if ( ! defined( 'ABSPATH' ) ) {
  die( '' ); // Don't call directly
}
add_action( 'vc_after_init', function () {
  vc_lean_map( 'vc_custom_google_fonts', null, dirname( __FILE__ ) . '/shortcode/vcmap.php' );
  require_once "shortcode/class.php";
}
);

Source:

An alternative solution (includes some loading fonts locally as well as a plugin option) here:

Related