PHP code example of getolympus / olympus-dionysos-field-font

1. Go to this page and download the library: Download getolympus/olympus-dionysos-field-font library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

getolympus / olympus-dionysos-field-font example snippets


return \GetOlympus\Dionysos\Field\Font::build('my_font_field_id', [
    'title'       => 'Select your character!',
    'default'     => [
        'family'         => 'Open Sans',
        'backup'         => 'Arial, Helvetica, sans-serif',
        'subset'         => 'latin',
        'variant'        => 'regular',
        'size'           => '16px',
        'lineheight'     => '1.8',
        'letterspacing'  => '0',
        'color'          => '#000000',
    ],
    'description' => 'Select your fighting stage!',
]);

// Get font from Database
$font = get_option('my_font_field_id', []);

// Check if font is empty and display it
if (!empty($font)) {
    echo '<h1 style="font-family:'.$font['family'].';font-size:'.$font['size'].'">My custom title</h1>';
}