Add Google Fonts parameter

⌘K
  1. Home
  2. Docs
  3. Developers “How To&...
  4. Add Google Fonts parameter

Add Google Fonts parameter

It is possible to add Google Fonts parameter to a custom element of WPBakery Page Builder  , by following these steps:

  1. Map attribute ‘google_fonts’
  2. Parse google fonts value in template
  3. Get google fonts settings for enqueue
  4. Enqueue font-family
  5. Create inline-style string to add google-fonts
  6. 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.

Was this article helpful to you? No 2 Yes

How can we help?