Filter: dslc_available_fonts – Adjust default fonts available for selection

By default, Live Composer  page builder includes a common set of regular (system) fonts and all the fonts from the Google Fonts directory (Google team adds new fonts every months, so if you see any of the fonts missing, please let us know and we will add them in the next update). All the font family names are stored in array that you can change via 'dslc_available_fonts' filter.

Here is the structure of the fonts array by default:

Array (
    [regular] => Array (
            [0] => Georgia
            [1] => Times
            [2] => Arial
            [3] => Lucida Sans Unicode
            [4] => Tahoma
            [5] => Trebuchet MS
            [6] => Verdana
            [7] => Helvetica
        )
    [google] => Array (
            [0] => ABeeZee
            [1] => Abel
            [2] => Abril Fatface
            [3] => Aclonica
            [4] => Acme
            [5] => Actor
            [6] => Adamina
            . . .        
            [631] => Zeyada
        )
)

You can limit or extend the font-family options available in the module settings by filtering this array via ' dslc_available_fonts' filter.

Here is a basic plugin that limit font options to Exo, Open Sans, Open Sans Condensed from the Google Directory and Arial, Helvetica from the system fonts:

<?php
/*
Plugin Name: Limit Fonts in Live Composer
Plugin URI: http://livecomposerplugin.com
Description: Plugin with some demo code limiting font options in the Live Composer.
Author: Live Composer Team
Version: 0.1
*/

/**
 * Function called to filter array of available fonts in Live Composer.
 * @param  array $fonts_to_filter List of all the fonts by default.
 * @return array                  Filtered list of fonts.
 */
function mycustompluginname_restrict_fonts( $fonts_to_filter ) {

	/**
	 * Limit available Google Fonts to the listed below fonts only.
	 */

	$allowed_google_fonts = array(
		'Exo',
		'Open Sans',
		'Open Sans Condensed',
	);

	$fonts_to_filter['google'] = $allowed_google_fonts;

	/**
	 * Limit available system fonts to the listed below fonts only.
	 */

	$allowed_system_fonts = array(
		'Arial',
		'Helvetica',
	);

	$fonts_to_filter['regular'] = $allowed_system_fonts;


    // Return filtered array.
    return $fonts_to_filter;
}

add_filter( 'dslc_available_fonts', 'mycustompluginname_restrict_fonts' );

Still need help? Contact Us Contact Us