It is possible to add Google Fonts parameter to a custom element of WPBakery Page Builder , by following these steps:
- Map attribute ‘google_fonts’
- Parse google fonts value in template
- Get google fonts settings for enqueue
- Enqueue font-family
- Create inline-style string to add google-fonts
- Add inline style to element
<?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";
}
);
For full example of Google Fonts param usage please visit GitHub repository with example element – VC Google Fonts Element.