PHP code example of getolympus / olympus-dionysos-field-header
1. Go to this page and download the library: Download getolympus/olympus-dionysos-field-header 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-header example snippets
return \GetOlympus\Dionysos\Field\Header::build('my_header_field_id', [
'title' => 'You\'re about to find out what it\'s like to fight a real Super Saiyan...',
'default' => [],
'description' => 'and I\'m not talking about Goku!',
'mode' => 'top',
/**
* Texts definition
* @see the `Texts definition` section below
*/
't_align_left' => 'Left',
't_align_center' => 'Center',
't_align_right' => 'Right',
't_align_expand' => 'Expand',
't_header_overall' => 'Overall header',
't_header_main' => 'Main header',
't_header_secondary' => 'Secondary header',
't_logo_no_display' => 'Hide website\'s baseline',
't_logo_display' => 'Display website\'s baseline',
't_navs_label' => 'Navigation menus',
't_search_label' => 'Search displays',
't_search_default' => 'Default',
't_search_drop' => 'Drop',
't_search_dropdown' => 'Dropdown',
't_search_modal' => 'Modal',
't_search_overlay' => 'Overlay',
't_text_default' => 'Call us today! 1.555.555.555',
't_type_label' => 'Choose a content type',
't_type_logo' => 'Website\'s logo',
't_type_nav' => 'Navigation menu',
't_type_search' => 'Search form',
't_type_text' => 'Custom text field',
't_addblock_label' => 'Click on the button to add content',
't_editblock_label' => 'Click on the button to edit content',
't_removeblock_label' => 'Remove',
't_updateblock_label' => 'Update',
]);
// Get headers from Database
$headers = get_option('my_header_field_id', []);
if (!empty($headers)) {
echo '<header>';
foreach ($headers as $name => $options) {
echo '<nav class="nav '.$name.'">';
echo '<ul>';
foreach ($options['contents'] as $content) {
# code...
echo '<li>'.$content[0].': '.$content[1].'</li>';
}
echo '</ul>';
echo '</nav>';
}
echo '</header>';
}