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

1. Go to this page and download the library: Download getolympus/olympus-dionysos-field-toggle 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-toggle example snippets


return \GetOlympus\Dionysos\Field\Toggle::build('my_toggle_field_id', [
    'title'       => 'Get ready to rumble!',
    'default'     => true,
    'description' => 'Put it on to get started',
]);

// Get toggle from Database
$toggle = get_option('my_toggle_field_id', false);

// Display toggle in HTML tag
echo $toggle ? 'Let\'s go!' : 'Not ready yet.';